Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 7e00bdd

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:fd1a0b0ee4d8 into amd-gfx:21aa606b362c
Local branch amd-gfx 21aa606 Merged main:cfbf0a500f17 into amd-gfx:4a56624c1a7e Remote branch main fd1a0b0 nfc, add test case for llvm-symbolizer on XCOFF
2 parents 21aa606 + fd1a0b0 commit 7e00bdd

Some content is hidden

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

46 files changed

+1223
-183
lines changed

clang/lib/Driver/ToolChains/DragonFly.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA,
5656
const InputInfoList &Inputs,
5757
const ArgList &Args,
5858
const char *LinkingOutput) const {
59-
const Driver &D = getToolChain().getDriver();
59+
const auto &ToolChain = static_cast<const DragonFly &>(getToolChain());
60+
const Driver &D = ToolChain.getDriver();
6061
ArgStringList CmdArgs;
6162

6263
if (!D.SysRoot.empty())
@@ -115,21 +116,24 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA,
115116
Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
116117
}
117118

118-
Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group});
119+
Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
120+
options::OPT_s, options::OPT_t, options::OPT_r});
121+
ToolChain.AddFilePathLibArgs(Args, CmdArgs);
119122

120123
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
121124

122125
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
123126
options::OPT_r)) {
124-
SmallString<128> Dir(D.SysRoot);
125-
llvm::sys::path::append(Dir, "/usr/lib/gcc80");
126-
CmdArgs.push_back(Args.MakeArgString("-L" + Dir));
127-
128127
if (!Args.hasArg(options::OPT_static)) {
129128
CmdArgs.push_back("-rpath");
130129
CmdArgs.push_back("/usr/lib/gcc80");
131130
}
132131

132+
// Use the static OpenMP runtime with -static-openmp
133+
bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
134+
!Args.hasArg(options::OPT_static);
135+
addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
136+
133137
if (D.CCCIsCXX()) {
134138
if (getToolChain().ShouldLinkCXXStdlib(Args))
135139
getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,8 +1967,9 @@ void UnwrappedLineParser::parseStructuralElement(
19671967
auto I = Line->Tokens.begin(), E = Line->Tokens.end();
19681968
while (I != E && I->Tok->is(tok::comment))
19691969
++I;
1970-
while (I != E && Style.isVerilog() && I->Tok->is(tok::hash))
1971-
++I;
1970+
if (Style.isVerilog())
1971+
while (I != E && I->Tok->is(tok::hash))
1972+
++I;
19721973
return I != E && (++I == E);
19731974
};
19741975
if (OneTokenSoFar()) {

clang/test/Driver/dragonfly.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: FileCheck -input-file %t.log %s
33

44
// CHECK: "-cc1" "-triple" "x86_64-pc-dragonfly"
5-
// CHECK: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/usr/libexec/ld-elf.so.{{.*}}" "--hash-style=gnu" "--enable-new-dtags" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-L{{.*}}gcc{{.*}}" "-rpath" "{{.*}}gcc{{.*}}" "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o"
5+
// CHECK: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/usr/libexec/ld-elf.so.{{.*}}" "--hash-style=gnu" "--enable-new-dtags" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "-L{{.*}}/../lib" "-L/usr/lib" "-L/usr/lib/gcc80" "{{.*}}.o" "-rpath" "{{.*}}gcc80{{.*}}" "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o"
66

77
// Check x86_64-unknown-dragonfly, X86_64
88
// RUN: %clang -### %s 2>&1 --target=x86_64-unknown-dragonfly \
@@ -15,7 +15,8 @@
1515
// CHECK-LD-X86_64-SAME: "[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o"
1616
// CHECK-LD-X86_64-SAME: "[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o"
1717
// CHECK-LD-X86_64-SAME: "[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}gcc80{{/|\\\\}}crtbegin.o"
18-
// CHECK-LD-X86_64-SAME: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}gcc80" "-rpath" "/usr/lib/gcc80" "-lc" "-lgcc" "--as-needed" "-lgcc_pic" "--no-as-needed"
18+
// CHECK-LD-X86_64-SAME: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib" "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}gcc80"
19+
// CHECK-LD-X86_64-SAME: "-rpath" "/usr/lib/gcc80" "-lc" "-lgcc" "--as-needed" "-lgcc_pic" "--no-as-needed"
1920
// CHECK-LD-X86_64-SAME: "[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}gcc80{{/|\\\\}}crtend.o"
2021
// CHECK-LD-X86_64-SAME: "[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crtn.o"
2122

@@ -26,3 +27,8 @@
2627
// RELOCATABLE-NOT: "-dynamic-linker"
2728
// RELOCATABLE-NOT: "-l
2829
// RELOCATABLE-NOT: {{.*}}crt{{[^./]+}}.o
30+
31+
// Check that the new linker flags are passed to DragonFly
32+
// RUN: %clang --target=x86_64-unknown-dragonfly -s -t -### %s 2>&1 \
33+
// RUN: | FileCheck --check-prefix=CHECK-LD-FLAGS %s
34+
// CHECK-LD-FLAGS: ld{{.*}}" "{{.*}}" "-s" "-t"

clang/test/Driver/fopenmp.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
// RUN: %clang -target x86_64-openbsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
1414
// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
1515
// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
16+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
17+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
18+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
1619
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
1720
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
1821
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
@@ -90,6 +93,19 @@
9093
// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
9194
// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
9295
//
96+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP
97+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
98+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
99+
//
100+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
101+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
102+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
103+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC
104+
//
105+
// RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
106+
// RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
107+
// RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
108+
//
93109
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP
94110
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
95111
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5MD
@@ -136,7 +152,7 @@
136152
// CHECK-LD-STATIC-IOMP5: "-Bstatic" "-liomp5" "-Bdynamic"
137153
//
138154
// CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC: "{{.*}}ld{{(.exe)?}}"
139-
// For x86 Gnu, the driver passes -static, while FreeBSD, NetBSD and OpenBSD pass -Bstatic
155+
// For x86 Gnu, the driver passes -static, while FreeBSD, NetBSD, OpenBSD and DragonFly pass -Bstatic
140156
// CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC: "-{{B?}}static" {{.*}} "-liomp5"
141157
// CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC-NOT: "-Bdynamic"
142158
//
@@ -157,6 +173,7 @@
157173
// RUN: %clang -target x86_64-freebsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
158174
// RUN: %clang -target x86_64-netbsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
159175
// RUN: %clang -target x86_64-openbsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
176+
// RUN: %clang -target x86_64-dragonfly -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
160177
// RUN: %clang -target x86_64-windows-gnu -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANYMD
161178
//
162179
// CHECK-LD-ANY: "{{.*}}ld{{(.exe)?}}"

libc/config/linux/aarch64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ set(TARGET_PUBLIC_HEADERS
22
libc.include.assert
33
libc.include.ctype
44
libc.include.errno
5+
libc.include.features
56
libc.include.fenv
67
libc.include.inttypes
78
libc.include.math

libc/config/linux/riscv/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
44
libc.include.dirent
55
libc.include.errno
66
libc.include.fcntl
7+
libc.include.features
78
libc.include.fenv
89
libc.include.inttypes
910
libc.include.math

libc/config/linux/x86_64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
44
libc.include.dirent
55
libc.include.errno
66
libc.include.fcntl
7+
libc.include.features
78
libc.include.fenv
89
libc.include.inttypes
910
libc.include.math

libc/include/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ add_gen_header(
4646
.llvm-libc-types.mode_t
4747
)
4848

49+
add_gen_header(
50+
features
51+
DEF_FILE features.h.def
52+
GEN_HDR features.h
53+
DEPENDS
54+
.llvm_libc_common_h
55+
.llvm-libc-macros.features_macros
56+
)
57+
4958
add_gen_header(
5059
fenv
5160
DEF_FILE fenv.h.def

libc/include/features.h.def

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//===-- C standard library header features.h -------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_FEATURES_H
10+
#define LLVM_LIBC_FEATURES_H
11+
12+
#include <__llvm-libc-common.h>
13+
#include <llvm-libc-macros/features-macros.h>
14+
15+
%%public_api()
16+
17+
#endif // LLVM_LIBC_FEATURES_H

libc/include/llvm-libc-macros/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ add_macro_header(
4646
fcntl-macros.h
4747
)
4848

49+
add_macro_header(
50+
features_macros
51+
HDR
52+
features-macros.h
53+
)
54+
4955
add_macro_header(
5056
fenv_macros
5157
HDR

0 commit comments

Comments
 (0)