Skip to content

Commit c13a6a3

Browse files
author
iclsrc
committed
Merge from 'main' to 'sycl-web' (12 commits)
CONFLICT (content): Merge conflict in clang/lib/CodeGen/BackendUtil.cpp
2 parents 4dda6ad + d1e2b96 commit c13a6a3

File tree

25 files changed

+180
-85
lines changed

25 files changed

+180
-85
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ f6d557ee34b6bbdb1dc32f29e34b4a4a8ad35e81
7070

7171
# [libc++] Replace uses of _VSTD:: by std:: (#74331)
7272
77a00c0d546cd4aa8311b5b9031ae9ea8cdb050c
73+
74+
# [libc++] Format the code base (#74334)
75+
9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,11 +1167,14 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
11671167
}
11681168
}
11691169
if (CodeGenOpts.FatLTO) {
1170-
// Set module flags, like EnableSplitLTOUnit and UnifiedLTO, since FatLTO
1170+
// Set the EnableSplitLTOUnit and UnifiedLTO module flags, since FatLTO
11711171
// uses a different action than Backend_EmitBC or Backend_EmitLL.
1172+
<<<<<<< HEAD
11721173
if (!TheModule->getModuleFlag("ThinLTO"))
11731174
TheModule->addModuleFlag(Module::Error, "ThinLTO",
11741175
uint32_t(CodeGenOpts.PrepareForThinLTO));
1176+
=======
1177+
>>>>>>> d1e2b96b606e5bf8329ab5821f7a614163a56e16
11751178
if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
11761179
TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
11771180
uint32_t(CodeGenOpts.EnableSplitLTOUnit));

clang/lib/Lex/PPDirectives.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,11 +1858,18 @@ static void diagnoseAutoModuleImport(
18581858
// path to the file, build a properly-cased replacement in the vector,
18591859
// and return true if the replacement should be suggested.
18601860
static bool trySimplifyPath(SmallVectorImpl<StringRef> &Components,
1861-
StringRef RealPathName) {
1861+
StringRef RealPathName,
1862+
llvm::sys::path::Style Separator) {
18621863
auto RealPathComponentIter = llvm::sys::path::rbegin(RealPathName);
18631864
auto RealPathComponentEnd = llvm::sys::path::rend(RealPathName);
18641865
int Cnt = 0;
18651866
bool SuggestReplacement = false;
1867+
1868+
auto IsSep = [Separator](StringRef Component) {
1869+
return Component.size() == 1 &&
1870+
llvm::sys::path::is_separator(Component[0], Separator);
1871+
};
1872+
18661873
// Below is a best-effort to handle ".." in paths. It is admittedly
18671874
// not 100% correct in the presence of symlinks.
18681875
for (auto &Component : llvm::reverse(Components)) {
@@ -1872,10 +1879,11 @@ static bool trySimplifyPath(SmallVectorImpl<StringRef> &Components,
18721879
} else if (Cnt) {
18731880
--Cnt;
18741881
} else if (RealPathComponentIter != RealPathComponentEnd) {
1875-
if (Component != *RealPathComponentIter) {
1876-
// If these path components differ by more than just case, then we
1877-
// may be looking at symlinked paths. Bail on this diagnostic to avoid
1878-
// noisy false positives.
1882+
if (!IsSep(Component) && !IsSep(*RealPathComponentIter) &&
1883+
Component != *RealPathComponentIter) {
1884+
// If these non-separator path components differ by more than just case,
1885+
// then we may be looking at symlinked paths. Bail on this diagnostic to
1886+
// avoid noisy false positives.
18791887
SuggestReplacement =
18801888
RealPathComponentIter->equals_insensitive(Component);
18811889
if (!SuggestReplacement)
@@ -2451,7 +2459,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport(
24512459
}
24522460
#endif
24532461

2454-
if (trySimplifyPath(Components, RealPathName)) {
2462+
if (trySimplifyPath(Components, RealPathName, BackslashStyle)) {
24552463
SmallString<128> Path;
24562464
Path.reserve(Name.size()+2);
24572465
Path.push_back(isAngled ? '<' : '"');
@@ -2474,7 +2482,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport(
24742482
// got copied when the C: was processed and we want to skip that entry.
24752483
if (!(Component.size() == 1 && IsSep(Component[0])))
24762484
Path.append(Component);
2477-
else if (!Path.empty())
2485+
else if (Path.size() != 1)
24782486
continue;
24792487

24802488
// Append the separator(s) the user used, or the close quote

clang/test/CodeGen/fat-lto-objects.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
// SPLIT: ![[#]] = !{i32 1, !"EnableSplitLTOUnit", i32 1}
3636
// NOSPLIT: ![[#]] = !{i32 1, !"EnableSplitLTOUnit", i32 0}
3737

38-
/// Check that the ThinLTO metadata is set true for both full and thin LTO, since FatLTO is based on UnifiedLTO.
39-
// FULL: ![[#]] = !{i32 1, !"ThinLTO", i32 1}
38+
// FULL-NOT: ![[#]] = !{i32 1, !"ThinLTO", i32 0}
4039
// THIN-NOT: ![[#]] = !{i32 1, !"ThinLTO", i32 0}
4140

4241
/// FatLTO always uses UnifiedLTO. It's an error if they aren't set together
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// REQUIRES: case-insensitive-filesystem
2+
3+
// RUN: rm -rf %t && split-file %s %t
4+
// RUN: sed "s|DIR|%/t|g" %t/tu.c.in > %t/tu.c
5+
// RUN: %clang_cc1 -fsyntax-only %t/tu.c 2>&1 | FileCheck %s --DDIR=%/t
6+
7+
//--- header.h
8+
//--- tu.c.in
9+
#import "DIR/Header.h"
10+
// CHECK: tu.c:1:9: warning: non-portable path to file '"[[DIR]]/header.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
11+
// CHECK-NEXT: 1 | #import "[[DIR]]/Header.h"
12+
// CHECK-NEXT: | ^~~~~~~~~~~~~~~~~~
13+
// CHECK-NEXT: | "[[DIR]]/header.h"

compiler-rt/lib/asan/asan_posix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void PlatformTSDDtor(void *tsd) {
149149
#endif
150150

151151
void InstallAtForkHandler() {
152-
# if SANITIZER_SOLARIS || SANITIZER_NETBSD
152+
# if SANITIZER_SOLARIS || SANITIZER_NETBSD || SANITIZER_APPLE
153153
return; // FIXME: Implement FutexWait.
154154
# endif
155155
auto before = []() {

compiler-rt/lib/lsan/lsan_posix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void InstallAtExitCheckLeaks() {
101101
}
102102

103103
void InstallAtForkHandler() {
104-
# if SANITIZER_SOLARIS || SANITIZER_NETBSD
104+
# if SANITIZER_SOLARIS || SANITIZER_NETBSD || SANITIZER_APPLE
105105
return; // FIXME: Implement FutexWait.
106106
# endif
107107
auto before = []() {

compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// FIXME: Requires `FutexWait` implementation. See __asan::InstallAtForkHandler.
1616
// UNSUPPORTED: target={{.*solaris.*}}
1717
// UNSUPPORTED: target={{.*netbsd.*}}
18+
// UNSUPPORTED: target={{.*apple.*}}
1819

1920
// Forking in multithread environment is unsupported. However we already have
2021
// some workarounds, and will add more, so this is the test.

libc/config/linux/app.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,21 @@ typedef uintptr_t ArgcType;
4949
typedef uintptr_t ArgVEntryType;
5050

5151
typedef uintptr_t EnvironType;
52-
typedef uintptr_t AuxEntryType;
5352
#else
5453
#error "argc and argv types are not defined for the target platform."
5554
#endif
5655

56+
// Linux manpage on `proc(5)` says that the aux vector is an array of
57+
// unsigned long pairs.
58+
// (see: https://man7.org/linux/man-pages/man5/proc.5.html)
59+
using AuxEntryType = unsigned long;
60+
// Using the naming convention from `proc(5)`.
61+
// TODO: Would be nice to use the aux entry structure from elf.h when available.
62+
struct AuxEntry {
63+
AuxEntryType id;
64+
AuxEntryType value;
65+
};
66+
5767
struct Args {
5868
ArgcType argc;
5969

@@ -78,6 +88,9 @@ struct AppProperties {
7888

7989
// Environment data.
8090
EnvironType *env_ptr;
91+
92+
// Auxiliary vector data.
93+
AuxEntry *auxv_ptr;
8194
};
8295

8396
extern AppProperties app;

libc/startup/linux/aarch64/start.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,7 @@ static void call_fini_array_callbacks() {
126126
} // namespace LIBC_NAMESPACE
127127

128128
using LIBC_NAMESPACE::app;
129-
130-
// TODO: Would be nice to use the aux entry structure from elf.h when available.
131-
struct AuxEntry {
132-
uint64_t type;
133-
uint64_t value;
134-
};
129+
using LIBC_NAMESPACE::AuxEntry;
135130

136131
__attribute__((noinline)) static void do_start() {
137132
auto tid = LIBC_NAMESPACE::syscall_impl<long>(SYS_gettid);
@@ -155,9 +150,9 @@ __attribute__((noinline)) static void do_start() {
155150
// denoted by an AT_NULL entry.
156151
Elf64_Phdr *program_hdr_table = nullptr;
157152
uintptr_t program_hdr_count;
158-
for (AuxEntry *aux_entry = reinterpret_cast<AuxEntry *>(env_end_marker + 1);
159-
aux_entry->type != AT_NULL; ++aux_entry) {
160-
switch (aux_entry->type) {
153+
app.auxv_ptr = reinterpret_cast<AuxEntry *>(env_end_marker + 1);
154+
for (auto *aux_entry = app.auxv_ptr; aux_entry->id != AT_NULL; ++aux_entry) {
155+
switch (aux_entry->id) {
161156
case AT_PHDR:
162157
program_hdr_table = reinterpret_cast<Elf64_Phdr *>(aux_entry->value);
163158
break;

0 commit comments

Comments
 (0)