Skip to content

Commit 5a0f197

Browse files
committed
merge main into amd-staging
2 parents 7e7c135 + 9456e7f commit 5a0f197

File tree

31 files changed

+541
-402
lines changed

31 files changed

+541
-402
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,6 +2672,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
26722672
bool UseNoExecStack = false;
26732673
bool Msa = false;
26742674
const char *MipsTargetFeature = nullptr;
2675+
llvm::SmallVector<const char *> SparcTargetFeatures;
26752676
StringRef ImplicitIt;
26762677
for (const Arg *A :
26772678
Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler,
@@ -2817,6 +2818,31 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
28172818
if (MipsTargetFeature)
28182819
continue;
28192820
break;
2821+
2822+
case llvm::Triple::sparc:
2823+
case llvm::Triple::sparcel:
2824+
case llvm::Triple::sparcv9:
2825+
if (Value == "--undeclared-regs") {
2826+
// LLVM already allows undeclared use of G registers, so this option
2827+
// becomes a no-op. This solely exists for GNU compatibility.
2828+
// TODO implement --no-undeclared-regs
2829+
continue;
2830+
}
2831+
SparcTargetFeatures =
2832+
llvm::StringSwitch<llvm::SmallVector<const char *>>(Value)
2833+
.Case("-Av8", {"-v8plus"})
2834+
.Case("-Av8plus", {"+v8plus", "+v9"})
2835+
.Case("-Av8plusa", {"+v8plus", "+v9", "+vis"})
2836+
.Case("-Av8plusb", {"+v8plus", "+v9", "+vis", "+vis2"})
2837+
.Case("-Av8plusd", {"+v8plus", "+v9", "+vis", "+vis2", "+vis3"})
2838+
.Case("-Av9", {"+v9"})
2839+
.Case("-Av9a", {"+v9", "+vis"})
2840+
.Case("-Av9b", {"+v9", "+vis", "+vis2"})
2841+
.Case("-Av9d", {"+v9", "+vis", "+vis2", "+vis3"})
2842+
.Default({});
2843+
if (!SparcTargetFeatures.empty())
2844+
continue;
2845+
break;
28202846
}
28212847

28222848
if (Value == "-force_cpusubtype_ALL") {
@@ -2921,6 +2947,10 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
29212947
CmdArgs.push_back("-target-feature");
29222948
CmdArgs.push_back(MipsTargetFeature);
29232949
}
2950+
for (const char *Feature : SparcTargetFeatures) {
2951+
CmdArgs.push_back("-target-feature");
2952+
CmdArgs.push_back(Feature);
2953+
}
29242954

29252955
// forward -fembed-bitcode to assmebler
29262956
if (C.getDriver().embedBitcodeEnabled() ||

clang/test/Driver/sparc-ias-Wa.s

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// RUN: %clang --target=sparc-linux-gnu -### -fintegrated-as -c %s -Wa,-Av8 2>&1 | \
2+
// RUN: FileCheck -check-prefix=V8 %s
3+
// V8: -cc1as
4+
// V8: "-target-feature" "-v8plus"
5+
6+
// RUN: %clang --target=sparc-linux-gnu -### -fintegrated-as -c %s -Wa,-Av8plus 2>&1 | \
7+
// RUN: FileCheck -check-prefix=V8PLUS %s
8+
// V8PLUS: -cc1as
9+
// V8PLUS: "-target-feature" "+v8plus"
10+
// V8PLUS: "-target-feature" "+v9"
11+
12+
// RUN: %clang --target=sparc-linux-gnu -### -fintegrated-as -c %s -Wa,-Av8plusa 2>&1 | \
13+
// RUN: FileCheck -check-prefix=V8PLUSA %s
14+
// V8PLUSA: -cc1as
15+
// V8PLUSA: "-target-feature" "+v8plus"
16+
// V8PLUSA: "-target-feature" "+v9"
17+
// V8PLUSA: "-target-feature" "+vis"
18+
19+
// RUN: %clang --target=sparc-linux-gnu -### -fintegrated-as -c %s -Wa,-Av8plusb 2>&1 | \
20+
// RUN: FileCheck -check-prefix=V8PLUSB %s
21+
// V8PLUSB: -cc1as
22+
// V8PLUSB: "-target-feature" "+v8plus"
23+
// V8PLUSB: "-target-feature" "+v9"
24+
// V8PLUSB: "-target-feature" "+vis"
25+
// V8PLUSB: "-target-feature" "+vis2"
26+
27+
// RUN: %clang --target=sparc-linux-gnu -### -fintegrated-as -c %s -Wa,-Av8plusd 2>&1 | \
28+
// RUN: FileCheck -check-prefix=V8PLUSD %s
29+
// V8PLUSD: -cc1as
30+
// V8PLUSD: "-target-feature" "+v8plus"
31+
// V8PLUSD: "-target-feature" "+v9"
32+
// V8PLUSD: "-target-feature" "+vis"
33+
// V8PLUSD: "-target-feature" "+vis2"
34+
// V8PLUSD: "-target-feature" "+vis3"
35+
36+
// RUN: %clang --target=sparc-linux-gnu -### -fintegrated-as -c %s -Wa,-Av9 2>&1 | \
37+
// RUN: FileCheck -check-prefix=V9 %s
38+
// V9: -cc1as
39+
// V9: "-target-feature" "+v9"
40+
41+
// RUN: %clang --target=sparc-linux-gnu -### -fintegrated-as -c %s -Wa,-Av9a 2>&1 | \
42+
// RUN: FileCheck -check-prefix=V9A %s
43+
// V9A: -cc1as
44+
// V9A: "-target-feature" "+v9"
45+
// V9A: "-target-feature" "+vis"
46+
47+
// RUN: %clang --target=sparc-linux-gnu -### -fintegrated-as -c %s -Wa,-Av9b 2>&1 | \
48+
// RUN: FileCheck -check-prefix=V9B %s
49+
// V9B: -cc1as
50+
// V9B: "-target-feature" "+v9"
51+
// V9B: "-target-feature" "+vis"
52+
// V9B: "-target-feature" "+vis2"
53+
54+
// RUN: %clang --target=sparc-linux-gnu -### -fintegrated-as -c %s -Wa,-Av9d 2>&1 | \
55+
// RUN: FileCheck -check-prefix=V9D %s
56+
// V9D: -cc1as
57+
// V9D: "-target-feature" "+v9"
58+
// V9D: "-target-feature" "+vis"
59+
// V9D: "-target-feature" "+vis2"
60+
// V9D: "-target-feature" "+vis3"

compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ struct SizeClassAllocator32LocalCache {
166166
DCHECK_GT(c->count, 0);
167167
}
168168
void *res = c->batch[--c->count];
169-
PREFETCH(c->batch[c->count - 1]);
169+
PREFETCH(c->batch[c->count > 0 ? c->count - 1 : 0]);
170170
stats_.Add(AllocatorStatAllocated, c->class_size);
171171
return res;
172172
}

compiler-rt/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ fputwc U
103103
free U
104104
freelocale U
105105
fwrite U
106+
getauxval U
106107
getc U
107108
getcwd U
108109
getenv U

lldb/tools/lldb-dap/package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lldb/tools/lldb-dap/package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lldb-dap",
33
"displayName": "LLDB DAP",
4-
"version": "0.2.9",
4+
"version": "0.2.10",
55
"publisher": "llvm-vs-code-extensions",
66
"homepage": "https://lldb.llvm.org",
77
"description": "LLDB debugging from VSCode",
@@ -27,7 +27,7 @@
2727
"Debuggers"
2828
],
2929
"devDependencies": {
30-
"@types/node": "^18.11.18",
30+
"@types/node": "^18.19.41",
3131
"@types/vscode": "1.75.0",
3232
"@vscode/vsce": "^3.2.2",
3333
"prettier-plugin-curly": "^0.3.1",
@@ -86,7 +86,7 @@
8686
"default": {},
8787
"description": "The environment of the lldb-dap process.",
8888
"additionalProperties": {
89-
"type": "string"
89+
"type": "string"
9090
}
9191
}
9292
}
@@ -152,6 +152,10 @@
152152
"program"
153153
],
154154
"properties": {
155+
"debugAdapterExecutable": {
156+
"type": "string",
157+
"markdownDescription": "The absolute path to the LLDB debug adapter executable to use."
158+
},
155159
"program": {
156160
"type": "string",
157161
"description": "Path to the program to debug."
@@ -338,6 +342,10 @@
338342
},
339343
"attach": {
340344
"properties": {
345+
"debugAdapterExecutable": {
346+
"type": "string",
347+
"markdownDescription": "The absolute path to the LLDB debug adapter executable to use."
348+
},
341349
"program": {
342350
"type": "string",
343351
"description": "Path to the program to attach to."

lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ async function findDAPExecutable(): Promise<string | undefined> {
5050
const executable = process.platform === "win32" ? "lldb-dap.exe" : "lldb-dap";
5151

5252
// Prefer lldb-dap from Xcode on Darwin.
53-
const xcrun_dap = findWithXcrun(executable);
53+
const xcrun_dap = await findWithXcrun(executable);
5454
if (xcrun_dap) {
5555
return xcrun_dap;
5656
}
5757

5858
// Find lldb-dap in the user's path.
59-
const path_dap = findInPath(executable);
59+
const path_dap = await findInPath(executable);
6060
if (path_dap) {
6161
return path_dap;
6262
}
@@ -67,12 +67,17 @@ async function findDAPExecutable(): Promise<string | undefined> {
6767
async function getDAPExecutable(
6868
session: vscode.DebugSession,
6969
): Promise<string | undefined> {
70+
// Check if the executable was provided in the launch configuration.
71+
const launchConfigPath = session.configuration["debugAdapterExecutable"];
72+
if (typeof launchConfigPath === "string" && launchConfigPath.length !== 0) {
73+
return launchConfigPath;
74+
}
75+
76+
// Check if the executable was provided in the extension's configuration.
7077
const config = vscode.workspace.getConfiguration(
7178
"lldb-dap",
7279
session.workspaceFolder,
7380
);
74-
75-
// Prefer the explicitly specified path in the extension's configuration.
7681
const configPath = config.get<string>("executable-path");
7782
if (configPath && configPath.length !== 0) {
7883
return configPath;

llvm/cmake/config-ix.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
319319
check_symbol_exists(isatty unistd.h HAVE_ISATTY)
320320
check_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS)
321321
check_symbol_exists(futimes sys/time.h HAVE_FUTIMES)
322+
check_symbol_exists(getauxval sys/auxv.h HAVE_GETAUXVAL)
322323
# AddressSanitizer conflicts with lib/Support/Unix/Signals.inc
323324
# Avoid sigaltstack on Apple platforms, where backtrace() cannot handle it
324325
# (rdar://7089625) and _Unwind_Backtrace is unusable because it cannot unwind

llvm/include/llvm/Config/config.h.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,4 +295,6 @@
295295

296296
#cmakedefine HAVE_BUILTIN_THREAD_POINTER ${HAVE_BUILTIN_THREAD_POINTER}
297297

298+
#cmakedefine HAVE_GETAUXVAL ${HAVE_GETAUXVAL}
299+
298300
#endif

llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ static int (*RemoveFindDynamicUnwindSections)(void *) = nullptr;
5959

6060
UnwindInfoManager::~UnwindInfoManager() {
6161
if (int Err = RemoveFindDynamicUnwindSections((void *)&findSections)) {
62+
(void)Err; // Silence unused variable warning in release builds.
6263
LLVM_DEBUG({
6364
dbgs() << "Failed call to " << RemoveFnName << ": error = " << Err
6465
<< "\n";
6566
});
67+
(void)Err;
6668
}
6769
}
6870

@@ -85,6 +87,7 @@ bool UnwindInfoManager::TryEnable() {
8587
Instance.reset(new UnwindInfoManager());
8688

8789
if (auto Err = AddFn((void *)&findSections)) {
90+
(void)Err; // Silence unused variable warning in release builds.
8891
LLVM_DEBUG({
8992
dbgs() << "Failed call to " << AddFnName << ": error = " << Err << "\n";
9093
});

0 commit comments

Comments
 (0)