Skip to content

Commit cac19f2

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project into bitcode_writer_should_be_defensive
2 parents ca659d4 + 81d93af commit cac19f2

File tree

91 files changed

+4587
-1146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+4587
-1146
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,8 +1732,6 @@ defm gnu_inline_asm : BoolFOption<"gnu-inline-asm",
17321732
"Disable GNU style inline asm">,
17331733
PosFlag<SetTrue>>;
17341734

1735-
def fprofile_sample_use : Flag<["-"], "fprofile-sample-use">, Group<f_Group>,
1736-
Visibility<[ClangOption, CLOption]>;
17371735
def fno_profile_sample_use : Flag<["-"], "fno-profile-sample-use">, Group<f_Group>,
17381736
Visibility<[ClangOption, CLOption]>;
17391737
def fprofile_sample_use_EQ : Joined<["-"], "fprofile-sample-use=">,
@@ -1759,8 +1757,6 @@ def fsample_profile_use_profi : Flag<["-"], "fsample-profile-use-profi">,
17591757
basic block counts to branch probabilites to fix them by extended
17601758
and re-engineered classic MCMF (min-cost max-flow) approach.}]>;
17611759
def fno_profile_sample_accurate : Flag<["-"], "fno-profile-sample-accurate">, Group<f_Group>;
1762-
def fauto_profile : Flag<["-"], "fauto-profile">, Group<f_Group>,
1763-
Alias<fprofile_sample_use>;
17641760
def fno_auto_profile : Flag<["-"], "fno-auto-profile">, Group<f_Group>,
17651761
Alias<fno_profile_sample_use>;
17661762
def fauto_profile_EQ : Joined<["-"], "fauto-profile=">,

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,18 +1763,13 @@ Arg *tools::getLastProfileUseArg(const ArgList &Args) {
17631763

17641764
Arg *tools::getLastProfileSampleUseArg(const ArgList &Args) {
17651765
auto *ProfileSampleUseArg = Args.getLastArg(
1766-
options::OPT_fprofile_sample_use, options::OPT_fprofile_sample_use_EQ,
1767-
options::OPT_fauto_profile, options::OPT_fauto_profile_EQ,
1768-
options::OPT_fno_profile_sample_use, options::OPT_fno_auto_profile);
1769-
1770-
if (ProfileSampleUseArg &&
1771-
(ProfileSampleUseArg->getOption().matches(
1772-
options::OPT_fno_profile_sample_use) ||
1773-
ProfileSampleUseArg->getOption().matches(options::OPT_fno_auto_profile)))
1766+
options::OPT_fprofile_sample_use_EQ, options::OPT_fno_profile_sample_use);
1767+
1768+
if (ProfileSampleUseArg && (ProfileSampleUseArg->getOption().matches(
1769+
options::OPT_fno_profile_sample_use)))
17741770
return nullptr;
17751771

1776-
return Args.getLastArg(options::OPT_fprofile_sample_use_EQ,
1777-
options::OPT_fauto_profile_EQ);
1772+
return Args.getLastArg(options::OPT_fprofile_sample_use_EQ);
17781773
}
17791774

17801775
const char *tools::RelocationModelName(llvm::Reloc::Model Model) {

clang/test/Driver/clang_f_opts.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@
7171
// RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof -fno-auto-profile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-AUTO-PROFILE %s
7272
// CHECK-NO-AUTO-PROFILE-NOT: "-fprofile-sample-use={{.*}}/file.prof"
7373

74-
// RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof -fno-profile-sample-use -fauto-profile %s 2>&1 | FileCheck -check-prefix=CHECK-AUTO-PROFILE %s
75-
// RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof -fno-auto-profile -fprofile-sample-use %s 2>&1 | FileCheck -check-prefix=CHECK-AUTO-PROFILE %s
76-
7774
// RUN: %clang -### -S -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-LLVM %s
7875
// RUN: %clang -### -S -fprofile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
7976
// RUN: %clang -### -S -fprofile-generate=/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-DIR %s
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// GCC -fauto-profile (without =) is rejected.
2+
/// -fprofile-sample-use without = is rejected as well.
3+
// RUN: not %clang -### -S -fauto-profile -fprofile-sample-use %s 2>&1 | FileCheck %s --check-prefix=ERR
4+
// ERR: error: unknown argument: '-fauto-profile'
5+
// ERR: error: unknown argument: '-fprofile-sample-use'

compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,16 @@ INTERCEPTOR(int, kevent64, int kq, const struct kevent64_s *changelist,
736736
#define RTSAN_MAYBE_INTERCEPT_KEVENT64
737737
#endif // SANITIZER_INTERCEPT_KQUEUE
738738

739+
INTERCEPTOR(int, pipe, int pipefd[2]) {
740+
__rtsan_notify_intercepted_call("pipe");
741+
return REAL(pipe)(pipefd);
742+
}
743+
744+
INTERCEPTOR(int, mkfifo, const char *pathname, mode_t mode) {
745+
__rtsan_notify_intercepted_call("mkfifo");
746+
return REAL(mkfifo)(pathname, mode);
747+
}
748+
739749
// Preinit
740750
void __rtsan::InitializeInterceptors() {
741751
INTERCEPT_FUNCTION(calloc);
@@ -836,6 +846,9 @@ void __rtsan::InitializeInterceptors() {
836846
RTSAN_MAYBE_INTERCEPT_KQUEUE;
837847
RTSAN_MAYBE_INTERCEPT_KEVENT;
838848
RTSAN_MAYBE_INTERCEPT_KEVENT64;
849+
850+
INTERCEPT_FUNCTION(pipe);
851+
INTERCEPT_FUNCTION(mkfifo);
839852
}
840853

841854
#endif // SANITIZER_POSIX

compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,4 +965,17 @@ TEST_F(KqueueTest, Kevent64DiesWhenRealtime) {
965965
}
966966
#endif // SANITIZER_INTERCEPT_KQUEUE
967967

968+
TEST(TestRtsanInterceptors, MkfifoDiesWhenRealtime) {
969+
auto Func = []() { mkfifo("/tmp/rtsan_test_fifo", 0); };
970+
ExpectRealtimeDeath(Func, "mkfifo");
971+
ExpectNonRealtimeSurvival(Func);
972+
}
973+
974+
TEST(TestRtsanInterceptors, PipeDiesWhenRealtime) {
975+
int fds[2];
976+
auto Func = [&fds]() { pipe(fds); };
977+
ExpectRealtimeDeath(Func, "pipe");
978+
ExpectNonRealtimeSurvival(Func);
979+
}
980+
968981
#endif // SANITIZER_POSIX

0 commit comments

Comments
 (0)