Changeset 16554 in niluje


Ignore:
Timestamp:
Oct 8, 2019, 7:37:32 PM (10 days ago)
Author:
NiLuJe
Message:

Kindle Hacks:

  • X-TC:
    • We are a go for compiler-rt ;).
Location:
Configs/trunk/Kindle/Misc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Configs/trunk/Kindle/Misc/x-clang-compiler-rt.sh

    r16553 r16554  
    1616# First, we'll need the right env
    1717# NOTE: Hardcoded to Kobo because that's what I care about ;).
    18 . ${SCRIPTS_BASE_DIR}/x-compile.sh kobo env clang
     18. ${SCRIPTS_BASE_DIR}/x-compile.sh kobo env clang-gcc
    1919
    2020# We'll need the sources...
     
    3030
    3131# c.f., https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html
    32 tar -xvJf /usr/portage/distfiles/compiler-rt-9.0.0.src.tar.xz
    33 cd compiler-rt-9.0.0.src
     32CLANG_VERSION="9.0.0"
     33tar -xvJf /usr/portage/distfiles/compiler-rt-${CLANG_VERSION}.src.tar.xz
     34cd compiler-rt-${CLANG_VERSION}.src
    3435mkdir build
    3536cd build
     37# NOTE: Install path is the *live* Clang installation from the host (Gentoo paths)!
     38#       That's mainly because I can't be arsed to figure out how to tel lld to go look elsewhere for those.
    3639cmake .. -G Ninja \
     40        -DCOMPILER_RT_INSTALL_PATH="/usr/lib/clang/${CLANG_VERSION}" \
    3741        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    3842        -DCOMPILER_RT_INCLUDE_TESTS=OFF \
     
    5458        -DCMAKE_ASM_FLAGS="${CFLAGS}"
    5559ninja -v
    56 
    57 ## Figure out where we can install that, ideally somewhere that's not my real rootfs... :D.
     60# NOTE: That's not particularly great, but, eh.
     61sudo ninja -v install
  • Configs/trunk/Kindle/Misc/x-compile.sh

    r16553 r16554  
    824824                #export LDFLAGS="${LDFLAGS} -static-libstdc++"
    825825        # And let's try to break some stuff w/ Clang (just the Gentoo ebuild w/ ARM in LLVM_TARGETS for now)
    826         elif [[ "${3}" == "clang" ]] ; then
     826        elif [[ "${3}" == "clang" ]] || [[ "${3}" == "clang-gcc" ]] ; then
    827827                echo "* With Clang :)"
    828828                # Implies bare, because this is just a (fun?) experiment...
     
    846846                export CC="clang"
    847847                export CXX="clang++"
    848                 # NOTE: The --gcc-toolchain bit is mainly helpful to lld (apparently)
    849                 # NOTE: Ideally, we'd prefer using --rtlib=compiler-rt, but that probably requires a fully integrated cross-tc build...
    850                 #       (i.e., Gentoo's compiler-rt ebuild only builds that for the host, which makes sense).
    851                 # NOTE: In the same vein, we also have to go with libstdc++, so no --stdlib=libc++ either ;).
    852                 # NOTE: I could, supposedly, simply cross-compile compiler-rt myself?
    853                 #       c.f., https://archive.fosdem.org/2018/schedule/event/crosscompile/attachments/slides/2107/export/events/attachments/crosscompile/slides/2107/How_to_cross_compile_with_LLVM_based_tools.pdf
    854                 #       which points to https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html
    855                 export CFLAGS="--target=${CROSS_TC} --sysroot=$(${CROSS_TC}-gcc -print-sysroot) --gcc-toolchain=${HOME}/x-tools/${CROSS_TC} ${RICE_CFLAGS}"
    856                 export CXXFLAGS="--target=${CROSS_TC} --sysroot=$(${CROSS_TC}-gcc -print-sysroot) --gcc-toolchain=${HOME}/x-tools/${CROSS_TC} ${RICE_CFLAGS}"
    857                 export LDFLAGS="-fuse-ld=lld ${BASE_LDFLAGS}"
     848                # Swap between compiler-rt and libgcc
     849                # c.f., x-clang-compiler-rt.sh to build compiler-rt in the first place ;).
     850                if [[ "${3}" == "clang-gcc" ]] ; then
     851                        export CFLAGS="--target=${CROSS_TC} --sysroot=$(${CROSS_TC}-gcc -print-sysroot) --gcc-toolchain=${HOME}/x-tools/${CROSS_TC} ${RICE_CFLAGS}"
     852                        export CXXFLAGS="--target=${CROSS_TC} --sysroot=$(${CROSS_TC}-gcc -print-sysroot) --gcc-toolchain=${HOME}/x-tools/${CROSS_TC} ${RICE_CFLAGS}"
     853                        export LDFLAGS="-fuse-ld=lld ${BASE_LDFLAGS}"
     854                else
     855                        export CFLAGS="--target=${CROSS_TC} --sysroot=$(${CROSS_TC}-gcc -print-sysroot) ${RICE_CFLAGS}"
     856                        export CXXFLAGS="--target=${CROSS_TC} --sysroot=$(${CROSS_TC}-gcc -print-sysroot) ${RICE_CFLAGS}"
     857                        export LDFLAGS="--rtlib=compiler-rt -fuse-ld=lld ${BASE_LDFLAGS}"
     858                fi
    858859                export AR="llvm-ar"
    859860                export NM="llvm-nm"
Note: See TracChangeset for help on using the changeset viewer.