Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🍒 swift/release/6.1] Import missing release/19.x commits #9760

Open
wants to merge 42 commits into
base: swift/release/6.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6925f3c
Reapply "[sanitizer_common] AND signals in BlockSignals instead of de…
thurstond Nov 14, 2024
aadaa00
[WebAssembly] Fix rethrow's index calculation (#114693)
aheejin Nov 6, 2024
51dee6b
Bump version to 19.1.5
tru Nov 19, 2024
02930b8
[NVPTX] Promote v2i8 to v2i16 (#111189)
manasij7479 Oct 4, 2024
e032d7a
[clang-repl] Improve flags responsible for generating shared wasm bin…
anutosh491 Nov 19, 2024
fb6b195
[compiler-rt] [test] Remove an unintended grep parameter
mstorsjo Oct 20, 2024
ea96040
[Mips] Change vsplat_imm_eq_1 to a ComplexPattern. (#116471)
topperc Nov 17, 2024
3d12f45
[SDAG][ISel][TableGen][LoongArch] Report error for trivial bitcasts w…
dtcxzyw Nov 19, 2024
f9ae37c
[InstCombine] Handle constant GEP expr in `SimplifyDemandedUseBits` (…
dtcxzyw Nov 19, 2024
e80925b
[lld][Hexagon] Fix R_HEX_B22_PCREL range checks (#115925)
quic-akaryaki Nov 19, 2024
5bd0474
[LICM] allow MemoryAccess creation failure (#116813)
DianQK Nov 20, 2024
336f877
[LoongArch] Fix GOT usage for `non-dso_local` function calls in large…
wangleiat Nov 21, 2024
11be11b
[SCEV] Fix sext handling for `getConstantMultiple` (#117093)
dtcxzyw Nov 21, 2024
7e2da7d
[ConstraintElim] Bail out on non-dedicated exits when adding exiting …
dtcxzyw Nov 18, 2024
32cbe24
[MachineLICM] Add test case showing load hoisted across memory barrier.
fhahn Nov 20, 2024
086d8e6
[MachineLICM] Don't allow hoisting invariant loads across mem barrier…
fhahn Nov 21, 2024
0e7e5d9
[InstCombine] Drop noundef attributes in `foldCttzCtlz` (#116718)
dtcxzyw Nov 19, 2024
edded5a
[SLP][NFC]Add a test with the incorrect casting of the abs argument, NFC
alexey-bataev Oct 18, 2024
9f72c98
[SLP]Check that operand of abs does not overflow before making it par…
alexey-bataev Oct 18, 2024
dc665fa
[MC][LoongArch] Change default cpu in `MCSubtargetInfo`. (#114922)
ylzsx Nov 11, 2024
f64f76f
Bail out jump threading on indirect branches (#103688)
hiraditya Sep 11, 2024
321f0dd
Bail out jump threading on indirect branches only (#117778)
hiraditya Nov 26, 2024
e6bcdea
[clang-repl] Fix generation of wasm binaries while running clang-repl…
anutosh491 Nov 29, 2024
cf55b9c
[AArch64][Darwin][SME] Don't try to save VG to the stack for unwinding.
aemerson Aug 13, 2024
4716c47
[AArch64][SME] Return false from produceCompactUnwindFrame if VG save…
kmclaughlin-arm Aug 19, 2024
876d050
[AArch64][SME] Fix iterator to fixupCalleeSaveRestoreStackOffset (#11…
sdesmalen-arm Oct 15, 2024
ab4b5a2
[clang] recognize hexagon-*-ld.lld variants (#117338)
androm3da Nov 29, 2024
c9e72b3
Bump version to 19.1.6
tru Dec 13, 2024
3d21a9a
[Clang][perf-training] Fix clean command in perf-helper.py (#118978)
tstellar Dec 7, 2024
d2953ab
[lld][WebAssembly] Fix use of uninitialized stack data with --wasm64 …
sbc100 Sep 9, 2024
be6e2e7
[offload] - Fix issue with standalone debug offload build (#104647)
estewart08 Aug 19, 2024
e3b2d01
[offload] Include CheckCXXCompilerFlag in CMake
mgorny Nov 30, 2024
5ce79b5
[offload] [test] Add "omp" test dependency only when present
mgorny Nov 30, 2024
909104b
[offload] Define OPENMP_TEST*_FLAGS in standalone builds
mgorny Nov 30, 2024
b70bf59
[offload] Define LIBOMPTARGET_OPENMP_*_FOLDER in standalone builds
mgorny Nov 30, 2024
2384a06
[cmake] Use DetectTestCompiler from openmp directory
mgorny Dec 1, 2024
8069ce6
[WebAssembly] Support multiple `.init_array` fragments when writing W…
georgestagg Dec 4, 2024
8e9465b
[WebAssembly] Handle symbols in `.init_array` sections (#119127)
georgestagg Dec 10, 2024
657e03f
[AggressiveInstCombine] Use APInt and avoid truncation when folding l…
antoniofrighetto Dec 4, 2024
e21dc4b
[SimpleLoopUnswitch] Fix LCSSA phi node invalidation
nikic Nov 27, 2024
1f01ca0
[InstCombine] Pre-commit tests for #100008 (NFC)
AZero13 Nov 9, 2024
b7b5bc4
[InstCombine] Canonicalize more saturated-add variants (#100008)
AZero13 Nov 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions clang/lib/Driver/ToolChains/Hexagon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,10 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
bool IncStartFiles = !Args.hasArg(options::OPT_nostartfiles);
bool IncDefLibs = !Args.hasArg(options::OPT_nodefaultlibs);
bool UseG0 = false;
const char *Exec = Args.MakeArgString(HTC.GetLinkerPath());
bool UseLLD = (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") ||
llvm::sys::path::stem(Exec).equals_insensitive("ld.lld"));
bool UseLLD = false;
const char *Exec = Args.MakeArgString(HTC.GetLinkerPath(&UseLLD));
UseLLD = UseLLD || llvm::sys::path::filename(Exec).ends_with("ld.lld") ||
llvm::sys::path::stem(Exec).ends_with("ld.lld");
bool UseShared = IsShared && !IsStatic;
StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args);

Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(LLVM_LINK_COMPONENTS
if (EMSCRIPTEN AND "lld" IN_LIST LLVM_ENABLE_PROJECTS)
set(WASM_SRC Wasm.cpp)
set(WASM_LINK lldWasm)
set(COMMON_LINK lldCommon)
endif()

add_clang_library(clangInterpreter
Expand Down Expand Up @@ -45,6 +46,7 @@ add_clang_library(clangInterpreter
clangSema
clangSerialization
${WASM_LINK}
${COMMON_LINK}
)

if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Interpreter/IncrementalExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class IncrementalExecutor {
virtual llvm::Error addModule(PartialTranslationUnit &PTU);
virtual llvm::Error removeModule(PartialTranslationUnit &PTU);
virtual llvm::Error runCtors() const;
llvm::Error cleanUp();
virtual llvm::Error cleanUp();
llvm::Expected<llvm::orc::ExecutorAddr>
getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const;

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ IncrementalCompilerBuilder::CreateCpp() {
#ifdef __EMSCRIPTEN__
Argv.push_back("-target");
Argv.push_back("wasm32-unknown-emscripten");
Argv.push_back("-pie");
Argv.push_back("-shared");
Argv.push_back("-fvisibility=default");
#endif
Argv.insert(Argv.end(), UserArgs.begin(), UserArgs.end());

Expand Down
65 changes: 50 additions & 15 deletions clang/lib/Interpreter/Wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@
#include <string>

namespace lld {
enum Flavor {
Invalid,
Gnu, // -flavor gnu
MinGW, // -flavor gnu MinGW
WinLink, // -flavor link
Darwin, // -flavor darwin
Wasm, // -flavor wasm
};

using Driver = bool (*)(llvm::ArrayRef<const char *>, llvm::raw_ostream &,
llvm::raw_ostream &, bool, bool);

struct DriverDef {
Flavor f;
Driver d;
};

struct Result {
int retCode;
bool canRunAgain;
};

Result lldMain(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
llvm::raw_ostream &stderrOS, llvm::ArrayRef<DriverDef> drivers);

namespace wasm {
bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput);
Expand Down Expand Up @@ -51,13 +76,14 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
llvm::TargetMachine *TargetMachine = Target->createTargetMachine(
PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_);
PTU.TheModule->setDataLayout(TargetMachine->createDataLayout());
std::string OutputFileName = PTU.TheModule->getName().str() + ".wasm";
std::string ObjectFileName = PTU.TheModule->getName().str() + ".o";
std::string BinaryFileName = PTU.TheModule->getName().str() + ".wasm";

std::error_code Error;
llvm::raw_fd_ostream OutputFile(llvm::StringRef(OutputFileName), Error);
llvm::raw_fd_ostream ObjectFileOutput(llvm::StringRef(ObjectFileName), Error);

llvm::legacy::PassManager PM;
if (TargetMachine->addPassesToEmitFile(PM, OutputFile, nullptr,
if (TargetMachine->addPassesToEmitFile(PM, ObjectFileOutput, nullptr,
llvm::CodeGenFileType::ObjectFile)) {
return llvm::make_error<llvm::StringError>(
"Wasm backend cannot produce object.", llvm::inconvertibleErrorCode());
Expand All @@ -69,27 +95,30 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
llvm::inconvertibleErrorCode());
}

OutputFile.close();
ObjectFileOutput.close();

std::vector<const char *> LinkerArgs = {"wasm-ld",
"-pie",
"-shared",
"--import-memory",
"--no-entry",
"--export-all",
"--experimental-pic",
"--no-export-dynamic",
"--stack-first",
OutputFileName.c_str(),
"--allow-undefined",
ObjectFileName.c_str(),
"-o",
OutputFileName.c_str()};
int Result =
lld::wasm::link(LinkerArgs, llvm::outs(), llvm::errs(), false, false);
if (!Result)
BinaryFileName.c_str()};

const lld::DriverDef WasmDriver = {lld::Flavor::Wasm, &lld::wasm::link};
std::vector<lld::DriverDef> WasmDriverArgs;
WasmDriverArgs.push_back(WasmDriver);
lld::Result Result =
lld::lldMain(LinkerArgs, llvm::outs(), llvm::errs(), WasmDriverArgs);

if (Result.retCode)
return llvm::make_error<llvm::StringError>(
"Failed to link incremental module", llvm::inconvertibleErrorCode());

void *LoadedLibModule =
dlopen(OutputFileName.c_str(), RTLD_NOW | RTLD_GLOBAL);
dlopen(BinaryFileName.c_str(), RTLD_NOW | RTLD_GLOBAL);
if (LoadedLibModule == nullptr) {
llvm::errs() << dlerror() << '\n';
return llvm::make_error<llvm::StringError>(
Expand All @@ -109,6 +138,12 @@ llvm::Error WasmIncrementalExecutor::runCtors() const {
return llvm::Error::success();
}

llvm::Error WasmIncrementalExecutor::cleanUp() {
// Can't call cleanUp through IncrementalExecutor as it
// tries to deinitialize JIT which hasn't been initialized
return llvm::Error::success();
}

WasmIncrementalExecutor::~WasmIncrementalExecutor() = default;

} // namespace clang
} // namespace clang
1 change: 1 addition & 0 deletions clang/lib/Interpreter/Wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class WasmIncrementalExecutor : public IncrementalExecutor {
llvm::Error addModule(PartialTranslationUnit &PTU) override;
llvm::Error removeModule(PartialTranslationUnit &PTU) override;
llvm::Error runCtors() const override;
llvm::Error cleanUp() override;

~WasmIncrementalExecutor() override;
};
Expand Down
2 changes: 1 addition & 1 deletion clang/utils/perf-training/perf-helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def clean(args):
+ "\tRemoves all files with extension from <path>."
)
return 1
for path in args[1:-1]:
for path in args[0:-1]:
for filename in findFilesWithExtension(path, args[-1]):
os.remove(filename)
return 0
Expand Down
2 changes: 1 addition & 1 deletion cmake/Modules/LLVMVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
set(LLVM_VERSION_MINOR 1)
endif()
if(NOT DEFINED LLVM_VERSION_PATCH)
set(LLVM_VERSION_PATCH 4)
set(LLVM_VERSION_PATCH 6)
endif()
if(NOT DEFINED LLVM_VERSION_SUFFIX)
set(LLVM_VERSION_SUFFIX)
Expand Down
55 changes: 39 additions & 16 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,33 +160,56 @@ void SetSigProcMask(__sanitizer_sigset_t *set, __sanitizer_sigset_t *oldset) {
CHECK_EQ(0, internal_sigprocmask(SIG_SETMASK, set, oldset));
}

# if SANITIZER_LINUX
// Deletes the specified signal from newset, if it is not present in oldset
// Equivalently: newset[signum] = newset[signum] & oldset[signum]
static void KeepUnblocked(__sanitizer_sigset_t &newset,
__sanitizer_sigset_t &oldset, int signum) {
// FIXME: https://github.com/google/sanitizers/issues/1816
if (SANITIZER_ANDROID || !internal_sigismember(&oldset, signum))
internal_sigdelset(&newset, signum);
}
# endif

// Block asynchronous signals
void BlockSignals(__sanitizer_sigset_t *oldset) {
__sanitizer_sigset_t set;
internal_sigfillset(&set);
# if SANITIZER_LINUX && !SANITIZER_ANDROID
__sanitizer_sigset_t newset;
internal_sigfillset(&newset);

# if SANITIZER_LINUX
__sanitizer_sigset_t currentset;

# if !SANITIZER_ANDROID
// FIXME: https://github.com/google/sanitizers/issues/1816
SetSigProcMask(NULL, &currentset);

// Glibc uses SIGSETXID signal during setuid call. If this signal is blocked
// on any thread, setuid call hangs.
// See test/sanitizer_common/TestCases/Linux/setuid.c.
internal_sigdelset(&set, 33);
# endif
# if SANITIZER_LINUX
KeepUnblocked(newset, currentset, 33);
# endif // !SANITIZER_ANDROID

// Seccomp-BPF-sandboxed processes rely on SIGSYS to handle trapped syscalls.
// If this signal is blocked, such calls cannot be handled and the process may
// hang.
internal_sigdelset(&set, 31);
KeepUnblocked(newset, currentset, 31);

# if !SANITIZER_ANDROID
// Don't block synchronous signals
internal_sigdelset(&set, SIGSEGV);
internal_sigdelset(&set, SIGBUS);
internal_sigdelset(&set, SIGILL);
internal_sigdelset(&set, SIGTRAP);
internal_sigdelset(&set, SIGABRT);
internal_sigdelset(&set, SIGFPE);
internal_sigdelset(&set, SIGPIPE);
# endif
// but also don't unblock signals that the user had deliberately blocked.
// FIXME: https://github.com/google/sanitizers/issues/1816
KeepUnblocked(newset, currentset, SIGSEGV);
KeepUnblocked(newset, currentset, SIGBUS);
KeepUnblocked(newset, currentset, SIGILL);
KeepUnblocked(newset, currentset, SIGTRAP);
KeepUnblocked(newset, currentset, SIGABRT);
KeepUnblocked(newset, currentset, SIGFPE);
KeepUnblocked(newset, currentset, SIGPIPE);
# endif //! SANITIZER_ANDROID

# endif // SANITIZER_LINUX

SetSigProcMask(&set, oldset);
SetSigProcMask(&newset, oldset);
}

ScopedBlockSignals::ScopedBlockSignals(__sanitizer_sigset_t *copy) {
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(SANITIZER_UNITTESTS
sanitizer_array_ref_test.cpp
sanitizer_atomic_test.cpp
sanitizer_bitvector_test.cpp
sanitizer_block_signals.cpp
sanitizer_bvgraph_test.cpp
sanitizer_chained_origin_depot_test.cpp
sanitizer_common_test.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//===-- sanitizer_block_signals.cpp ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file is a part of sanitizer_common unit tests.
//
//===----------------------------------------------------------------------===//
#include <signal.h>
#include <stdio.h>

#include "gtest/gtest.h"
#include "sanitizer_common/sanitizer_linux.h"

namespace __sanitizer {

#if SANITIZER_LINUX && !SANITIZER_ANDROID
volatile int received_sig = -1;

void signal_handler(int signum) { received_sig = signum; }

TEST(SanitizerCommon, NoBlockSignals) {
// No signals blocked
signal(SIGUSR1, signal_handler);
raise(SIGUSR1);
EXPECT_EQ(received_sig, SIGUSR1);

received_sig = -1;
signal(SIGPIPE, signal_handler);
raise(SIGPIPE);
EXPECT_EQ(received_sig, SIGPIPE);
}

TEST(SanitizerCommon, BlockSignalsPlain) {
// ScopedBlockSignals; SIGUSR1 should be blocked but not SIGPIPE
{
__sanitizer_sigset_t sigset = {};
ScopedBlockSignals block(&sigset);

received_sig = -1;
signal(SIGUSR1, signal_handler);
raise(SIGUSR1);
EXPECT_EQ(received_sig, -1);

received_sig = -1;
signal(SIGPIPE, signal_handler);
raise(SIGPIPE);
EXPECT_EQ(received_sig, SIGPIPE);
}
EXPECT_EQ(received_sig, SIGUSR1);
}

TEST(SanitizerCommon, BlockSignalsExceptPipe) {
// Manually block SIGPIPE; ScopedBlockSignals should not unblock this
sigset_t block_sigset;
sigemptyset(&block_sigset);
sigaddset(&block_sigset, SIGPIPE);
sigprocmask(SIG_BLOCK, &block_sigset, NULL);
{
__sanitizer_sigset_t sigset = {};
ScopedBlockSignals block(&sigset);

received_sig = -1;
signal(SIGPIPE, signal_handler);
raise(SIGPIPE);
EXPECT_EQ(received_sig, -1);
}
sigprocmask(SIG_UNBLOCK, &block_sigset, NULL);
EXPECT_EQ(received_sig, SIGPIPE);
}
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID

} // namespace __sanitizer
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// static build, there won't be any clang_rt DLLs.
// RUN: not grep cl""ang_rt %t || \
// RUN: grep cl""ang_rt %t | xargs which | \
// RUN: xargs llvm-readobj --coff-imports | not grep dbghelp.dll %t
// RUN: xargs llvm-readobj --coff-imports | not grep dbghelp.dll

extern "C" int puts(const char *);

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.
// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is
// defined to XXYYZZ.
# define _LIBCPP_VERSION 190104
# define _LIBCPP_VERSION 190106

# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/Arch/Hexagon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ void Hexagon::relocate(uint8_t *loc, const Relocation &rel,
case R_HEX_B22_PCREL:
case R_HEX_GD_PLT_B22_PCREL:
case R_HEX_PLT_B22_PCREL:
checkInt(loc, val, 22, rel);
checkInt(loc, val, 24, rel);
or32le(loc, applyMask(0x1ff3ffe, val >> 2));
break;
case R_HEX_B22_PCREL_X:
Expand Down
2 changes: 1 addition & 1 deletion lld/test/ELF/emulation-loongarch.s
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# LA32-NEXT: StringTableSectionIndex:
# LA32-NEXT: }

# RUN: llvm-mc -filetype=obj -triple=loongarch64 %s -o %t.o
# RUN: llvm-mc -filetype=obj -triple=loongarch64 -mattr=+d %s -o %t.o
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefix=LA64 %s
# RUN: ld.lld -m elf64loongarch %t.o -o %t
Expand Down
2 changes: 1 addition & 1 deletion lld/test/ELF/hexagon-jump-error.s
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (p0) jump #1f
.section b15, "ax"
1:

# CHECK: relocation R_HEX_B22_PCREL out of range: 8388612 is not in [-2097152, 2097151]
# CHECK: relocation R_HEX_B22_PCREL out of range: 8388612 is not in [-8388608, 8388607]
jump #1f
.space (1<<23)
.section b22, "ax"
Expand Down
Loading