From 0207d7ca9e517ff53343f195ab4eced5317d07f1 Mon Sep 17 00:00:00 2001 From: Rmys Date: Fri, 27 Nov 2020 00:06:56 +0300 Subject: [PATCH] llvm rebuild --- programming/build/llvm/actions.py | 37 ++++++++------ programming/build/llvm/files/llvm64.patch | 21 ++++++++ programming/build/llvm/pspec.xml | 61 +++++++++++++---------- 3 files changed, 78 insertions(+), 41 deletions(-) create mode 100644 programming/build/llvm/files/llvm64.patch diff --git a/programming/build/llvm/actions.py b/programming/build/llvm/actions.py index 73ae966d47..a6e979d617 100755 --- a/programming/build/llvm/actions.py +++ b/programming/build/llvm/actions.py @@ -6,17 +6,17 @@ from pisi.actionsapi import autotools from pisi.actionsapi import pisitools from pisi.actionsapi import shelltools -from pisi.actionsapi import get from pisi.actionsapi import cmaketools +from pisi.actionsapi import get -projects = "clang;mlir" if get.buildTYPE() == "emul32" else "clang;clang-tools-extra;lld;lldb;polly;compiler-rt;mlir" +projects = "clang;lld;mlir" if get.buildTYPE() == "emul32" else "clang;clang-tools-extra;lld;lldb;polly;compiler-rt;mlir" libdir = "/usr/lib32/llvm" if get.buildTYPE() == "emul32" else "/usr/lib/llvm" lib = "lib32" if get.buildTYPE() == "emul32" else "lib" libsuffix = "32" if get.buildTYPE() == "emul32" else " " NoStrip = ["/usr/lib/clang/%s/lib/linux" %get.srcVERSION()] -WorkDir = "llvm-project-%s/llvm" %get.srcVERSION() +WorkDir = "llvm-project-%s" %get.srcVERSION() def setup(): pisitools.ldflags.add("-fuse-ld=lld -rtlib=libgcc") @@ -25,6 +25,8 @@ def setup(): if get.buildTYPE() == "emul32": + #shelltools.export("CC", "gcc -m32") + #shelltools.export("CXX", "g++ -m32") shelltools.export("CC", "clang -m32") shelltools.export("CXX", "clang++ -m32") shelltools.export("PKG_CONFIG_PATH","/usr/lib32/pkgconfig") @@ -34,12 +36,14 @@ def setup(): #shelltools.system("patch -p1 < enable-SSP-and-PIE-by-default.patch") #shelltools.cd("..") else: + #shelltools.export("CC", "gcc") + #shelltools.export("CXX", "g++") shelltools.export("CC", "clang") shelltools.export("CXX", "clang++") - shelltools.makedirs("build") + shelltools.makedirs("llvm/build") - shelltools.cd("build") + shelltools.cd("llvm/build") if get.buildTYPE() != "emul32": pisitools.cflags.add("-m64") @@ -58,7 +62,7 @@ def setup(): cmaketools.configure("-DCMAKE_BUILD_TYPE=Release \ - -G 'Unix Makefiles' \ + -G 'Ninja' \ %s \ -DLLVM_ENABLE_PROJECTS='%s' \ -DLLVM_LIBDIR_SUFFIX=%s \ @@ -66,29 +70,32 @@ def setup(): -DLLVM_BUILD_DOCS=OFF \ -DLLVM_ENABLE_RTTI=ON \ -DLLVM_ENABLE_EH=ON \ - -DBUILD_SHARED_LIBS=ON \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DCLANG_LINK_CLANG_DYLIB=ON \ + -DLLDB_USE_SYSTEM_SIX=1 \ -DLLVM_INCLUDEDIR=/usr/include \ -DLLVM_ENABLE_ASSERTIONS=OFF \ -DFFI_INCLUDE_DIR=/usr/include \ -DCOMPILER_RT_USE_LIBCXX=OFF" % (options, projects, libsuffix), sourceDir=".." ) def build(): - shelltools.cd("build") - - cmaketools.make() + shelltools.cd("llvm/build") + shelltools.system("ninja") + #cmaketools.make() def install(): - shelltools.cd("build") - - cmaketools.rawInstall("DESTDIR=%s" % get.installDIR()) + shelltools.cd("llvm/build") + shelltools.system("DESTDIR=%s ninja install" % get.installDIR()) + #cmaketools.rawInstall("DESTDIR=%s" % get.installDIR()) if get.buildTYPE() == "emul32": pisitools.domove("/emul32/lib32/", "/usr/") pisitools.insinto("/usr/include/llvm/Config/","%s/emul32/include/llvm/Config/llvm-config.h" % get.installDIR(),"llvm-config-32.h") pisitools.insinto("/usr/bin/","%s/emul32/bin/llvm-config" % get.installDIR(),"llvm-config-32") pisitools.removeDir("/emul32") - #pisitools.remove("/usr/lib/python2.7/site-packages/six.py") + #pisitools.remove("/usr/lib/python3.8/site-packages/six.py") shelltools.cd ("..") - + pisitools.dodoc("LICENSE.TXT", "README.txt") diff --git a/programming/build/llvm/files/llvm64.patch b/programming/build/llvm/files/llvm64.patch new file mode 100644 index 0000000000..f62b902010 --- /dev/null +++ b/programming/build/llvm/files/llvm64.patch @@ -0,0 +1,21 @@ +diff -Nuar a/lld/test/ELF/shared.s b/lld/test/ELF/shared.s +--- a/lld/test/ELF/shared.s 2020-10-07 13:10:48.000000000 +0300 ++++ b/lld/test/ELF/shared.s 2020-11-24 11:22:37.683751304 +0300 +@@ -3,7 +3,7 @@ + // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared.s -o %t2.o + // RUN: ld.lld --hash-style=sysv -shared %t2.o -soname=t2.so -o %t2.so + // RUN: llvm-readobj -S %t2.so | FileCheck --check-prefix=SO %s +-// RUN: ld.lld --hash-style=sysv -dynamic-linker /lib64/ld-linux-x86-64.so.2 -rpath foo -rpath bar --export-dynamic %t.o %t2.so -o %t ++// RUN: ld.lld --hash-style=sysv -dynamic-linker /lib/ld-linux-x86-64.so.2 -rpath foo -rpath bar --export-dynamic %t.o %t2.so -o %t + // RUN: llvm-readobj -S -l --dynamic-table --symbols --dyn-syms --section-data --hash-table %t | FileCheck %s + // RUN: ld.lld --hash-style=sysv %t.o %t2.so %t2.so -o %t2 + // RUN: llvm-readobj --dyn-syms %t2 | FileCheck --check-prefix=DONT_EXPORT %s +@@ -33,7 +33,7 @@ + // CHECK-NEXT: AddressAlignment: 1 + // CHECK-NEXT: EntrySize: 0 + // CHECK-NEXT: SectionData ( +-// CHECK-NEXT: 0000: 2F6C6962 36342F6C 642D6C69 6E75782D |/lib64/ld-linux-| ++// CHECK-NEXT: 0000: 2F6C6962 36342F6C 642D6C69 6E75782D |/lib/ld-linux-| + // CHECK-NEXT: 0010: 7838362D 36342E73 6F2E3200 |x86-64.so.2.| + // CHECK-NEXT: ) + // CHECK-NEXT: } diff --git a/programming/build/llvm/pspec.xml b/programming/build/llvm/pspec.xml index 4819ec566a..2d2b44be96 100755 --- a/programming/build/llvm/pspec.xml +++ b/programming/build/llvm/pspec.xml @@ -13,6 +13,7 @@ The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines, though it does provide helpful libraries that can be used to build them. https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/llvm-project-11.0.0.tar.xz + ninja zlib-devel libxml2-devel ncurses-devel @@ -30,8 +31,11 @@ lld - enable-SSP-and-PIE-by-default.patch + + + + @@ -40,11 +44,7 @@ library llvm-libs - libxml2 libgcc - ncurses - zlib - libffi /usr/bin @@ -54,12 +54,16 @@ /usr/include/polly* /usr/lib/llvm /usr/lib + /usr/lib/libMLIR*.a + /usr/lib/libmlir_c_r*.a /etc/ld.so.conf.d /etc/llvm /usr/share/doc /usr/share/vim /usr/share/llvm/cmake /usr/share/man + + /usr/lib/libPolly*.so 51-llvm.conf @@ -82,9 +86,14 @@ /usr/lib/libLLVM*.so.11 /usr/lib/LLVMgold.* /usr/lib/libLTO.* - /usr/lib/libPolly*.so - /usr/lib/libMLIR* - /usr/lib/libmlir* + + /usr/lib/libPolly.so* + /usr/lib/LLVMPolly.so* + /usr/lib/libPollyISL.so* + /usr/lib/libPollyPPCG.so* + /usr/lib/libRemarks.so* + /usr/lib/libMLIR*.so* + /usr/lib/libmlir*.so* /usr/lib/bfd-plugins/LLVMgold.so /usr/share/licenses/llvm-libs/LICENSE @@ -96,14 +105,11 @@ llvm-libs llvm-clang - zlib - libffi - libedit libgcc + libedit + libxml2 ncurses python3 - libxml2 - xz /usr/bin/argdumper @@ -112,7 +118,7 @@ /usr/lib/liblldb.so* /usr/lib/liblldb* /usr/lib/python2.7/site-packages/readline.so - /usr/lib/python2.7/site-packages/lldb/* + /usr/lib/python3.8/site-packages/lldb/* /usr/lib/liblldbIntelFeatures.so* /usr/lib/liblldbPluginExpressionParserClang.a /usr/lib/liblldbPluginObjCLanguage.a @@ -135,13 +141,6 @@ Linker from the LLVM project llvm-libs - zlib - libffi - libedit - libgcc - ncurses - python3 - libxml2 /usr/bin/ld.lld @@ -149,6 +148,7 @@ /usr/bin/lld /usr/bin/lld-link /usr/bin/wasm-ld + /usr/lib/liblldMachO2.so* /usr/lib/liblldCOFF.* /usr/lib/liblldCommon.* /usr/lib/liblldCore.* @@ -159,6 +159,7 @@ /usr/lib/liblldReaderWriter.* /usr/lib/liblldWasm.* /usr/lib/liblldYAML.* + /usr/lib/liblldMachO2.* /usr/share/doc/lld @@ -168,9 +169,11 @@ Development headers lld lld + libgcc /usr/include/lld/* + /usr/lib/cmake/lld/* @@ -189,6 +192,7 @@ /usr/share/opt-viewer /usr/libexec/ccc-* /usr/libexec/c++-* + /usr/share/man/man1/scan-build.1 @@ -196,6 +200,7 @@ compiler-rt Various runtime libraries used by Clang + libgcc /usr/lib/clang/11.0.0/lib/linux/*.so @@ -209,18 +214,22 @@ llvm llvm-libs + libxml2 libgcc - ncurses + /usr/bin/diagtool + /usr/bin/pp-trace + /usr/bin/modularize + /usr/bin/find-all-symbols /usr/bin/git-clang* /usr/bin/clang* /usr/bin/c-index-test /usr/bin/tblgen /usr/lib/libclang* /usr/lib/clang/ - - + + /usr/lib/libfindAllSymbols.so* /usr/share/man/man1/clang.1 /usr/lib/cmake/clang/Clang* /usr/share/clang @@ -239,7 +248,7 @@ /usr/include/clang-tidy - +