diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2022-04-08 23:28:25 +0200 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-04-23 10:43:32 -0700 |
commit | 01b31d98580beda60d154fad4acc6934d6e6745e (patch) | |
tree | e3968ca8b20c6bdc9a3272fd7de0d14cd3e4de1f /Ports/llvm/patches | |
parent | 9a898df1cd2e75ed5cc9ad58aaf30965a9cd58e1 (diff) | |
download | serenity-01b31d98580beda60d154fad4acc6934d6e6745e.zip |
Toolchain+Ports: Update LLVM to 14.0.1
Besides a version bump, the following changes have been made to our
toolchain infrastructure:
- LLVM/Clang is now built with -march=native if the host compiler
supports it. An exception to this is CI, as the toolchain cache is
shared among many different machines there.
- The LLVM tarball is not re-extracted if the hash of the applied
patches doesn't differ.
- The patches have been split up into atomic chunks.
- Port-specific patches have been integrated into the main patches,
which will aid in the work towards self-hosting.
- <sysroot>/usr/local/lib is now appended to the linker's search path by
default.
- --pack-dyn-relocs=relr is appended to the linker command line by
default, meaning ports take advantage of RELR relocations without any
patches or additional compiler flags.
The formatting of LLVM port's package.sh has been bothering me, so I
also indented the arguments to the CMake invocation.
Diffstat (limited to 'Ports/llvm/patches')
l--------- | Ports/llvm/patches | 1 | ||||
-rw-r--r-- | Ports/llvm/patches/ReadMe.md | 45 | ||||
-rw-r--r-- | Ports/llvm/patches/insert-ifdef-serenity.patch | 113 | ||||
l--------- | Ports/llvm/patches/llvm-backport-objcopy-update-section.patch | 1 | ||||
-rw-r--r-- | Ports/llvm/patches/remove-version-script.patch | 35 | ||||
l--------- | Ports/llvm/patches/toolchain.patch | 1 |
6 files changed, 1 insertions, 195 deletions
diff --git a/Ports/llvm/patches b/Ports/llvm/patches new file mode 120000 index 0000000000..12796d33b8 --- /dev/null +++ b/Ports/llvm/patches @@ -0,0 +1 @@ +../../Toolchain/Patches/llvm
\ No newline at end of file diff --git a/Ports/llvm/patches/ReadMe.md b/Ports/llvm/patches/ReadMe.md deleted file mode 100644 index 815e5a3336..0000000000 --- a/Ports/llvm/patches/ReadMe.md +++ /dev/null @@ -1,45 +0,0 @@ -# Patches for LLVM on SerenityOS - -## `insert-ifdef-serenity.patch` - -This patch adds several defines in order to omit things not supported by SerenityOS. - -### Status -- [ ] Local? -- [ ] Should be merged to upstream? -- [X] Resolves issue(s) with our side of things -- [x] Hack - -## `remove-version-script.patch` - -Instructs the linker to not build LLVM shared libraries (`libclang.so`, `libLTO.so`, etc.) with -symbol versioning, which our dynamic linker does not support. - -### Status -- [ ] Local? -- [x] Should be merged to upstream? -- [X] Resolves issue(s) with our side of things -- [ ] Hack - -## `toolchain.patch` - -Adds support for the `$arch-pc-serenity` target to the Clang front end. This makes the compiler -look for libraries and headers in the right places, and enables some security mitigations, like -stack-smashing protection and building position-independent executables by default. - -### Status -- [ ] Local? -- [x] Should be merged to upstream? -- [ ] Resolves issue(s) with our side of things -- [ ] Hack - -## `llvm-backport-objcopy-update-section.patch` - -Backports support for `llvm-objcopy --update-section` used by our toolchain from reviews.llvm.org/D112116. - -### Status -- [ ] Local? -- [ ] Should be merged to upstream? -- [ ] Resolves issues(s) with our side of things -- [ ] Hack - diff --git a/Ports/llvm/patches/insert-ifdef-serenity.patch b/Ports/llvm/patches/insert-ifdef-serenity.patch deleted file mode 100644 index e1b16686d7..0000000000 --- a/Ports/llvm/patches/insert-ifdef-serenity.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc -index c37b3a546..e51badb34 100644 ---- a/llvm/lib/Support/Unix/Path.inc -+++ b/llvm/lib/Support/Unix/Path.inc -@@ -109,7 +109,7 @@ typedef uint_t uint; - #endif - - #if defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) || \ -- defined(__MVS__) -+ defined(__MVS__) || defined(__serenity__) - #define STATVFS_F_FLAG(vfs) (vfs).f_flag - #else - #define STATVFS_F_FLAG(vfs) (vfs).f_flags -@@ -531,7 +531,7 @@ static bool is_local_impl(struct STATVFS &Vfs) { - - // vmount entry not found; "remote" is the conservative answer. - return false; --#elif defined(__MVS__) -+#elif defined(__MVS__) || defined(__serenity__) - // The file system can have an arbitrary structure on z/OS; must go with the - // conservative answer. - return false; -diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc -index be59bb023..ff8931308 100644 ---- a/llvm/lib/Support/Unix/Program.inc -+++ b/llvm/lib/Support/Unix/Program.inc -@@ -335,7 +335,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, - namespace llvm { - namespace sys { - --#ifndef _AIX -+#if !defined(_AIX) && !defined(__serenity__) - using ::wait4; - #else - static pid_t (wait4)(pid_t pid, int *status, int options, struct rusage *usage); -@@ -344,7 +344,7 @@ static pid_t (wait4)(pid_t pid, int *status, int options, struct rusage *usage); - } // namespace sys - } // namespace llvm - --#ifdef _AIX -+#if defined(_AIX) || defined(__serenity__) - #ifndef _ALL_SOURCE - extern "C" pid_t (wait4)(pid_t pid, int *status, int options, - struct rusage *usage); -@@ -357,7 +357,7 @@ pid_t (llvm::sys::wait4)(pid_t pid, int *status, int options, - - // AIX wait4 does not work well with WNOHANG. - if (!(options & WNOHANG)) -- return ::wait4(pid, status, options, usage); -+ return ::waitpid(pid, status, options); - - // For WNOHANG, we use waitid (which supports WNOWAIT) until the child process - // has terminated. -@@ -374,7 +374,7 @@ pid_t (llvm::sys::wait4)(pid_t pid, int *status, int options, - // The child has already terminated, so a blocking wait on it is okay in the - // absence of indiscriminate `wait` calls from the current process (which - // would cause the call here to fail with ECHILD). -- return ::wait4(pid, status, options & ~WNOHANG, usage); -+ return ::waitpid(pid, status, options & ~WNOHANG); - } - #endif - -@@ -534,10 +534,10 @@ llvm::sys::writeFileWithEncoding(StringRef FileName, StringRef Contents, - - bool llvm::sys::commandLineFitsWithinSystemLimits(StringRef Program, - ArrayRef<StringRef> Args) { -- static long ArgMax = sysconf(_SC_ARG_MAX); -+ static long ArgMax = 4096; - // POSIX requires that _POSIX_ARG_MAX is 4096, which is the lowest possible - // value for ARG_MAX on a POSIX compliant system. -- static long ArgMin = _POSIX_ARG_MAX; -+ static long ArgMin = 4096; - - // This the same baseline used by xargs. - long EffectiveArgMax = 128 * 1024; -diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp -index 7f197a50c..03bf029db 100644 ---- a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp -+++ b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp -@@ -50,7 +50,7 @@ void printErrorAndExit(Twine ErrMsg) { - } - - int openListener(std::string Host, std::string PortStr) { --#ifndef LLVM_ON_UNIX -+#if !defined(LLVM_ON_UNIX) || defined(__serenity__) - // FIXME: Add TCP support for Windows. - printErrorAndExit("listen option not supported"); - return 0; -diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp -index 8bd384ec7..a28e938ec 100644 ---- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp -+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp -@@ -770,7 +770,7 @@ static Expected<int> connectTCPSocket(std::string Host, std::string PortStr) { - - Expected<std::unique_ptr<ExecutorProcessControl>> - LLVMJITLinkRemoteExecutorProcessControl::ConnectToExecutor() { --#ifndef LLVM_ON_UNIX -+#if !defined(LLVM_ON_UNIX) || defined(__serenity__) - // FIXME: Add TCP support for Windows. - return make_error<StringError>("-" + OutOfProcessExecutorConnect.ArgStr + - " not supported on non-unix platforms", -diff -ruN llvm-orig/llvm-project-llvmorg-12.0.0/llvm/include/llvm/Support/SwapByteOrder.h llvm-project-llvmorg-12.0.0/llvm/include/llvm/Support/SwapByteOrder.h ---- llvm-orig/llvm-project-llvmorg-12.0.0/llvm/include/llvm/Support/SwapByteOrder.h 2021-04-06 19:38:18.000000000 +0300 -+++ llvm-project-llvmorg-12.0.0/llvm/include/llvm/Support/SwapByteOrder.h 2021-06-09 16:00:20.111549941 +0300 -@@ -22,7 +22,7 @@ - #endif - - #if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__) || \ -- defined(__Fuchsia__) || defined(__EMSCRIPTEN__) -+ defined(__Fuchsia__) || defined(__EMSCRIPTEN__) || defined(__serenity__) - #include <endian.h> - #elif defined(_AIX) - #include <sys/machine.h> diff --git a/Ports/llvm/patches/llvm-backport-objcopy-update-section.patch b/Ports/llvm/patches/llvm-backport-objcopy-update-section.patch deleted file mode 120000 index bba9bce43a..0000000000 --- a/Ports/llvm/patches/llvm-backport-objcopy-update-section.patch +++ /dev/null @@ -1 +0,0 @@ -../../../Toolchain/Patches/llvm-backport-objcopy-update-section.patch
\ No newline at end of file diff --git a/Ports/llvm/patches/remove-version-script.patch b/Ports/llvm/patches/remove-version-script.patch deleted file mode 100644 index 99954ee959..0000000000 --- a/Ports/llvm/patches/remove-version-script.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt -index bf88dca0a..dfac32b16 100644 ---- a/clang/tools/libclang/CMakeLists.txt -+++ b/clang/tools/libclang/CMakeLists.txt -@@ -80,7 +80,7 @@ if(MSVC) - set(LLVM_EXPORTED_SYMBOL_FILE) - endif() - --if (UNIX AND NOT APPLE) -+if (UNIX AND NOT APPLE AND NOT SERENITYOS) - set(LLVM_EXPORTED_SYMBOL_FILE) - set(USE_VERSION_SCRIPT ${LLVM_HAVE_LINK_VERSION_SCRIPT}) - endif() -diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt -index 76b9a25cb..808838926 100644 ---- a/llvm/tools/llvm-shlib/CMakeLists.txt -+++ b/llvm/tools/llvm-shlib/CMakeLists.txt -@@ -33,7 +33,7 @@ if(LLVM_BUILD_LLVM_DYLIB) - add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${INSTALL_WITH_TOOLCHAIN} ${SOURCES}) - - list(REMOVE_DUPLICATES LIB_NAMES) -- if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) -+ if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) OR (SERENITYOS) - OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") - OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "GNU") - OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD") -@@ -46,7 +46,7 @@ if(LLVM_BUILD_LLVM_DYLIB) - - # GNU ld doesn't resolve symbols in the version script. - set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive) -- if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW) -+ if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW AND NOT SERENITYOS) - # Solaris ld does not accept global: *; so there is no way to version *all* global symbols - set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map ${LIB_NAMES}) - endif() diff --git a/Ports/llvm/patches/toolchain.patch b/Ports/llvm/patches/toolchain.patch deleted file mode 120000 index 20ae89f0f3..0000000000 --- a/Ports/llvm/patches/toolchain.patch +++ /dev/null @@ -1 +0,0 @@ -../../../Toolchain/Patches/llvm.patch
\ No newline at end of file |