From b7ec248a616428387c50aa53f7653c7a71327fbb Mon Sep 17 00:00:00 2001 From: Kartatz <105828205+Kartatz@users.noreply.github.com> Date: Wed, 21 Aug 2024 16:42:18 -0300 Subject: [PATCH] Include sysroots from Debian 6 up to 9 Also allow cross-compiling software to these targets by adding wrappers that calls GCC/G++ with the appropriate --sysroot option. --- .github/workflows/build.yml | 10 +- .gitmodules | 3 + aarch64-unknown-linux-gnu.sh | 8 +- alpha-unknown-linux-gnu.sh | 6 +- arm-unknown-linux-gnueabi.sh | 6 +- arm-unknown-linux-gnueabihf.sh | 8 +- build.sh | 32 +- hppa-unknown-linux-gnu.sh | 6 +- submodules/debian-sysroot | 1 + toolchains/aarch64-unknown-linux-gnu.cmake | 7 +- toolchains/aarch64-unknown-linux-gnu.sh | 5 +- toolchains/alpha-unknown-linux-gnu.cmake | 5 +- toolchains/alpha-unknown-linux-gnu.sh | 5 +- toolchains/arm-unknown-linux-gnueabi.cmake | 5 +- toolchains/arm-unknown-linux-gnueabi.sh | 5 +- toolchains/arm-unknown-linux-gnueabihf.cmake | 5 +- toolchains/arm-unknown-linux-gnueabihf.sh | 5 +- toolchains/hppa-unknown-linux-gnu.cmake | 5 +- toolchains/hppa-unknown-linux-gnu.sh | 5 +- toolchains/i386-unknown-linux-gnu.cmake | 5 +- toolchains/i386-unknown-linux-gnu.sh | 5 +- toolchains/ia64-unknown-linux-gnu.cmake | 5 +- toolchains/ia64-unknown-linux-gnu.sh | 5 +- toolchains/mips-unknown-linux-gnu.cmake | 5 +- toolchains/mips-unknown-linux-gnu.sh | 5 +- .../mips64el-unknown-linux-gnuabi64.cmake | 5 +- toolchains/mips64el-unknown-linux-gnuabi64.sh | 5 +- toolchains/mipsel-unknown-linux-gnu.cmake | 5 +- toolchains/mipsel-unknown-linux-gnu.sh | 5 +- toolchains/powerpc-unknown-linux-gnu.cmake | 5 +- toolchains/powerpc-unknown-linux-gnu.sh | 5 +- .../powerpc64le-unknown-linux-gnu.cmake | 5 +- toolchains/powerpc64le-unknown-linux-gnu.sh | 5 +- toolchains/s390-unknown-linux-gnu.cmake | 5 +- toolchains/s390-unknown-linux-gnu.sh | 5 +- toolchains/s390x-unknown-linux-gnu.cmake | 5 +- toolchains/s390x-unknown-linux-gnu.sh | 5 +- toolchains/sparc-unknown-linux-gnu.cmake | 5 +- toolchains/sparc-unknown-linux-gnu.sh | 5 +- toolchains/x86_64-unknown-linux-gnu.cmake | 5 +- toolchains/x86_64-unknown-linux-gnu.sh | 5 +- tools/builtin_symbols.json | 1102 ----------------- tools/gcc-wrapper/filesystem.c | 26 + tools/gcc-wrapper/filesystem.h | 6 + tools/gcc-wrapper/main.c | 198 +++ tools/gcc-wrapper/path.c | 93 ++ tools/gcc-wrapper/path.h | 7 + tools/gcc-wrapper/pathsep.h | 6 + tools/make_builtins.py | 131 -- 49 files changed, 488 insertions(+), 1323 deletions(-) create mode 100644 .gitmodules create mode 160000 submodules/debian-sysroot delete mode 100644 tools/builtin_symbols.json create mode 100644 tools/gcc-wrapper/filesystem.c create mode 100644 tools/gcc-wrapper/filesystem.h create mode 100644 tools/gcc-wrapper/main.c create mode 100644 tools/gcc-wrapper/path.c create mode 100644 tools/gcc-wrapper/path.h create mode 100644 tools/gcc-wrapper/pathsep.h delete mode 100644 tools/make_builtins.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0dd97f9..234734a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: id: check-cache uses: actions/cache@main with: - key: gcc-14.2.0 + key: gcc-14.2.0-1 lookup-only: true path: | /tmp/x86_64-linux-gnu.tar.xz @@ -45,7 +45,7 @@ jobs: if: ${{ steps.check-cache.outputs.cache-hit != 'true' }} uses: actions/cache@main with: - key: gcc-14.2.0 + key: gcc-14.2.0-1 path: | /tmp/x86_64-linux-gnu.tar.xz /tmp/x86_64-linux-gnu.tar.xz.sha256 @@ -79,14 +79,10 @@ jobs: - uses: actions/checkout@main with: submodules: true - - name: Setup Python - uses: actions/setup-python@main - with: - python-version: '3.12' - name: Restore from cache uses: actions/cache@main with: - key: gcc-14.2.0 + key: gcc-14.2.0-1 fail-on-cache-miss: true path: | /tmp/x86_64-linux-gnu.tar.xz diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..976eb6c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "submodules/debian-sysroot"] + path = submodules/debian-sysroot + url = https://github.com/AmanoTeam/debian-sysroot diff --git a/aarch64-unknown-linux-gnu.sh b/aarch64-unknown-linux-gnu.sh index f64f76f..5e7fb28 100644 --- a/aarch64-unknown-linux-gnu.sh +++ b/aarch64-unknown-linux-gnu.sh @@ -1,10 +1,10 @@ #!/bin/bash declare packages=( - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/l/linux/linux-libc-dev_3.16.56-1+deb8u1_arm64.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/g/glibc/libc6-dev_2.19-18+deb8u10_arm64.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/g/glibc/libc6_2.19-18+deb8u10_arm64.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/s/systemtap/systemtap-sdt-dev_2.6-0.2_arm64.deb' + 'https://archive.debian.org/debian/pool/main/l/linux/linux-libc-dev_3.16.56-1+deb8u1_arm64.deb' + 'https://archive.debian.org/debian/pool/main/g/glibc/libc6-dev_2.19-18+deb8u10_arm64.deb' + 'https://archive.debian.org/debian/pool/main/g/glibc/libc6_2.19-18+deb8u10_arm64.deb' + 'https://archive.debian.org/debian/pool/main/s/systemtap/systemtap-sdt-dev_2.6-0.2_arm64.deb' ) declare extra_configure_flags='' diff --git a/alpha-unknown-linux-gnu.sh b/alpha-unknown-linux-gnu.sh index c22780c..fd18d0d 100644 --- a/alpha-unknown-linux-gnu.sh +++ b/alpha-unknown-linux-gnu.sh @@ -1,9 +1,9 @@ #!/bin/bash declare packages=( - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/l/linux-2.6/linux-libc-dev_2.6.26-29_alpha.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/g/glibc/libc6.1-dev_2.7-18lenny7_alpha.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/g/glibc/libc6.1_2.7-18lenny7_alpha.deb' + 'https://archive.debian.org/debian/pool/main/l/linux-2.6/linux-libc-dev_2.6.26-29_alpha.deb' + 'https://archive.debian.org/debian/pool/main/g/glibc/libc6.1-dev_2.7-18lenny7_alpha.deb' + 'https://archive.debian.org/debian/pool/main/g/glibc/libc6.1_2.7-18lenny7_alpha.deb' ) declare extra_configure_flags='' diff --git a/arm-unknown-linux-gnueabi.sh b/arm-unknown-linux-gnueabi.sh index f8ce144..713de09 100644 --- a/arm-unknown-linux-gnueabi.sh +++ b/arm-unknown-linux-gnueabi.sh @@ -1,9 +1,9 @@ #!/bin/bash declare packages=( - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/l/linux-2.6/linux-libc-dev_2.6.26-29_armel.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/g/glibc/libc6-dev_2.7-18lenny7_armel.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/g/glibc/libc6_2.7-18lenny7_armel.deb' + 'https://archive.debian.org/debian/pool/main/l/linux-2.6/linux-libc-dev_2.6.26-29_armel.deb' + 'https://archive.debian.org/debian/pool/main/g/glibc/libc6-dev_2.7-18lenny7_armel.deb' + 'https://archive.debian.org/debian/pool/main/g/glibc/libc6_2.7-18lenny7_armel.deb' ) declare extra_configure_flags='--with-arch=armv4t --with-float=soft --disable-libsanitizer' diff --git a/arm-unknown-linux-gnueabihf.sh b/arm-unknown-linux-gnueabihf.sh index 5eebd09..3dc2aae 100644 --- a/arm-unknown-linux-gnueabihf.sh +++ b/arm-unknown-linux-gnueabihf.sh @@ -1,10 +1,10 @@ #!/bin/bash declare packages=( - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian-security/pool/updates/main/l/linux/linux-libc-dev_3.2.102-1_armhf.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian-security/pool/updates/main/e/eglibc/libc6-dev_2.13-38+deb7u12_armhf.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian-security/pool/updates/main/e/eglibc/libc6_2.13-38+deb7u12_armhf.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/s/systemtap/systemtap-sdt-dev_1.7-1+deb7u1_armhf.deb' + 'https://archive.debian.org/debian-security/pool/updates/main/l/linux/linux-libc-dev_3.2.102-1_armhf.deb' + 'https://archive.debian.org/debian-security/pool/updates/main/e/eglibc/libc6-dev_2.13-38+deb7u12_armhf.deb' + 'https://archive.debian.org/debian-security/pool/updates/main/e/eglibc/libc6_2.13-38+deb7u12_armhf.deb' + 'https://archive.debian.org/debian/pool/main/s/systemtap/systemtap-sdt-dev_1.7-1+deb7u1_armhf.deb' ) declare extra_configure_flags='--with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb' diff --git a/build.sh b/build.sh index 4a54a2e..e837090 100644 --- a/build.sh +++ b/build.sh @@ -248,7 +248,7 @@ for target in "${targets[@]}"; do --with-static-standard-libraries \ --with-bugurl='https://github.com/AmanoTeam/obggcc/issues' \ --with-gcc-major-version-only \ - --with-pkgversion="OBGGCC v0.8-${obggcc_revision}" \ + --with-pkgversion="OBGGCC v0.9-${obggcc_revision}" \ --with-sysroot="${toolchain_directory}/${triple}" \ --with-native-system-header-dir='/include' \ --enable-__cxa_atexit \ @@ -301,3 +301,33 @@ for target in "${targets[@]}"; do patchelf --add-rpath '$ORIGIN/../../../../lib' "${toolchain_directory}/libexec/gcc/${triple}/"*'/cc1plus' patchelf --add-rpath '$ORIGIN/../../../../lib' "${toolchain_directory}/libexec/gcc/${triple}/"*'/lto1' done + +rm --recursive "${toolchain_directory}/${triple}" + +declare cc='gcc' + +if ! (( is_native )); then + cc="${CC}" +fi + +declare -r sysroot_tarball='/tmp/sysroot.tar.xz' +declare -r executable='/tmp/gcc-wrapper' + +while read item; do + declare glibc_version="$(jq '.glibc_version' <<< "${item}")" + declare triplet="$(jq --raw-output '.triplet' <<< "${item}")" + + "${cc}" \ + "${workdir}/tools/gcc-wrapper/filesystem.c" \ + "${workdir}/tools/gcc-wrapper/main.c" \ + "${workdir}/tools/gcc-wrapper/path.c" \ + -Os \ + -s \ + -o "${executable}" + + cp "${executable}" "${toolchain_directory}/bin/${triplet}${glibc_version}-gcc" + cp "${executable}" "${toolchain_directory}/bin/${triplet}${glibc_version}-g++" + + wget --no-verbose "https://github.com/AmanoTeam/debian-sysroot/releases/latest/download/${triplet}${glibc_version}.tar.xz" --output-document="${sysroot_tarball}" + tar --directory="${toolchain_directory}" --extract --file="${sysroot_tarball}" +done <<< "$(jq --compact-output '.[]' "${workdir}/submodules/debian-sysroot/dist.json")" diff --git a/hppa-unknown-linux-gnu.sh b/hppa-unknown-linux-gnu.sh index fd7d9cd..d69cfb1 100644 --- a/hppa-unknown-linux-gnu.sh +++ b/hppa-unknown-linux-gnu.sh @@ -1,9 +1,9 @@ #!/bin/bash declare packages=( - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/l/linux-2.6/linux-libc-dev_2.6.26-29_hppa.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/g/glibc/libc6-dev_2.7-18lenny7_hppa.deb' - 'https://web.archive.org/web/0if_/https://archive.debian.org/debian/pool/main/g/glibc/libc6_2.7-18lenny7_hppa.deb' + 'https://archive.debian.org/debian/pool/main/l/linux-2.6/linux-libc-dev_2.6.26-29_hppa.deb' + '/https://archive.debian.org/debian/pool/main/g/glibc/libc6-dev_2.7-18lenny7_hppa.deb' + 'https://archive.debian.org/debian/pool/main/g/glibc/libc6_2.7-18lenny7_hppa.deb' ) declare extra_configure_flags='--disable-libsanitizer' diff --git a/submodules/debian-sysroot b/submodules/debian-sysroot new file mode 160000 index 0000000..8cd10cc --- /dev/null +++ b/submodules/debian-sysroot @@ -0,0 +1 @@ +Subproject commit 8cd10ccf2efcf9f40742156632272842f79b9898 diff --git a/toolchains/aarch64-unknown-linux-gnu.cmake b/toolchains/aarch64-unknown-linux-gnu.cmake index 3603000..3a6711a 100644 --- a/toolchains/aarch64-unknown-linux-gnu.cmake +++ b/toolchains/aarch64-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "aarch64") -set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") +set(TARGET_GLIBC "2.19") +set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu${TARGET_GLIBC}") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/aarch64-unknown-linux-gnu.sh b/toolchains/aarch64-unknown-linux-gnu.sh index d968827..2eccc9e 100644 --- a/toolchains/aarch64-unknown-linux-gnu.sh +++ b/toolchains/aarch64-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC="2.19" CROSS_COMPILE_TRIPLET='aarch64-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/alpha-unknown-linux-gnu.cmake b/toolchains/alpha-unknown-linux-gnu.cmake index 5c3e5fb..9a8fc06 100644 --- a/toolchains/alpha-unknown-linux-gnu.cmake +++ b/toolchains/alpha-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "alpha") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/alpha-unknown-linux-gnu.sh b/toolchains/alpha-unknown-linux-gnu.sh index 588263a..554c445 100644 --- a/toolchains/alpha-unknown-linux-gnu.sh +++ b/toolchains/alpha-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='alpha-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/arm-unknown-linux-gnueabi.cmake b/toolchains/arm-unknown-linux-gnueabi.cmake index 8ed28cd..4bb80ed 100644 --- a/toolchains/arm-unknown-linux-gnueabi.cmake +++ b/toolchains/arm-unknown-linux-gnueabi.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "arm") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnueabi") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/arm-unknown-linux-gnueabi.sh b/toolchains/arm-unknown-linux-gnueabi.sh index 832f8d0..0410df7 100644 --- a/toolchains/arm-unknown-linux-gnueabi.sh +++ b/toolchains/arm-unknown-linux-gnueabi.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='arm-unknown-linux-gnueabi' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/arm-unknown-linux-gnueabihf.cmake b/toolchains/arm-unknown-linux-gnueabihf.cmake index e2a4f26..6c03544 100644 --- a/toolchains/arm-unknown-linux-gnueabihf.cmake +++ b/toolchains/arm-unknown-linux-gnueabihf.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "arm") +set(TARGET_GLIBC "2.13") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnueabihf") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/arm-unknown-linux-gnueabihf.sh b/toolchains/arm-unknown-linux-gnueabihf.sh index 0136396..420a1dd 100644 --- a/toolchains/arm-unknown-linux-gnueabihf.sh +++ b/toolchains/arm-unknown-linux-gnueabihf.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.13' CROSS_COMPILE_TRIPLET='arm-unknown-linux-gnueabihf' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/hppa-unknown-linux-gnu.cmake b/toolchains/hppa-unknown-linux-gnu.cmake index aefffb2..d19a790 100644 --- a/toolchains/hppa-unknown-linux-gnu.cmake +++ b/toolchains/hppa-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "hppa") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/hppa-unknown-linux-gnu.sh b/toolchains/hppa-unknown-linux-gnu.sh index 9c3221e..2db7a9c 100644 --- a/toolchains/hppa-unknown-linux-gnu.sh +++ b/toolchains/hppa-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='hppa-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/i386-unknown-linux-gnu.cmake b/toolchains/i386-unknown-linux-gnu.cmake index 63c70a5..09b7cd6 100644 --- a/toolchains/i386-unknown-linux-gnu.cmake +++ b/toolchains/i386-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "i386") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/i386-unknown-linux-gnu.sh b/toolchains/i386-unknown-linux-gnu.sh index b65b976..a55c6b1 100644 --- a/toolchains/i386-unknown-linux-gnu.sh +++ b/toolchains/i386-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='i386-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/ia64-unknown-linux-gnu.cmake b/toolchains/ia64-unknown-linux-gnu.cmake index 51058ca..a760a14 100644 --- a/toolchains/ia64-unknown-linux-gnu.cmake +++ b/toolchains/ia64-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "ia64") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/ia64-unknown-linux-gnu.sh b/toolchains/ia64-unknown-linux-gnu.sh index f112ee0..980d547 100644 --- a/toolchains/ia64-unknown-linux-gnu.sh +++ b/toolchains/ia64-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='ia64-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/mips-unknown-linux-gnu.cmake b/toolchains/mips-unknown-linux-gnu.cmake index a7b8c4c..53dc2b7 100644 --- a/toolchains/mips-unknown-linux-gnu.cmake +++ b/toolchains/mips-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "mips") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/mips-unknown-linux-gnu.sh b/toolchains/mips-unknown-linux-gnu.sh index eaf3eea..0a97a50 100644 --- a/toolchains/mips-unknown-linux-gnu.sh +++ b/toolchains/mips-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='mips-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/mips64el-unknown-linux-gnuabi64.cmake b/toolchains/mips64el-unknown-linux-gnuabi64.cmake index 3643038..74059b5 100644 --- a/toolchains/mips64el-unknown-linux-gnuabi64.cmake +++ b/toolchains/mips64el-unknown-linux-gnuabi64.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "mips64el") +set(TARGET_GLIBC "2.24") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnuabi64") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/mips64el-unknown-linux-gnuabi64.sh b/toolchains/mips64el-unknown-linux-gnuabi64.sh index 7c02210..242f14f 100644 --- a/toolchains/mips64el-unknown-linux-gnuabi64.sh +++ b/toolchains/mips64el-unknown-linux-gnuabi64.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.24' CROSS_COMPILE_TRIPLET='mips64el-unknown-linux-gnuabi64' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/mipsel-unknown-linux-gnu.cmake b/toolchains/mipsel-unknown-linux-gnu.cmake index 6fc131c..13623a1 100644 --- a/toolchains/mipsel-unknown-linux-gnu.cmake +++ b/toolchains/mipsel-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "mipsel") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/mipsel-unknown-linux-gnu.sh b/toolchains/mipsel-unknown-linux-gnu.sh index 09807ab..ec2b6ca 100644 --- a/toolchains/mipsel-unknown-linux-gnu.sh +++ b/toolchains/mipsel-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='mipsel-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/powerpc-unknown-linux-gnu.cmake b/toolchains/powerpc-unknown-linux-gnu.cmake index aa67cc6..c0f2c4e 100644 --- a/toolchains/powerpc-unknown-linux-gnu.cmake +++ b/toolchains/powerpc-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "powerpc") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/powerpc-unknown-linux-gnu.sh b/toolchains/powerpc-unknown-linux-gnu.sh index d984b8f..e513d22 100644 --- a/toolchains/powerpc-unknown-linux-gnu.sh +++ b/toolchains/powerpc-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='powerpc-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/powerpc64le-unknown-linux-gnu.cmake b/toolchains/powerpc64le-unknown-linux-gnu.cmake index edb95d0..d28ac40 100644 --- a/toolchains/powerpc64le-unknown-linux-gnu.cmake +++ b/toolchains/powerpc64le-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "powerpc64le") +set(TARGET_GLIBC "2.19") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/powerpc64le-unknown-linux-gnu.sh b/toolchains/powerpc64le-unknown-linux-gnu.sh index 5817c55..318f605 100644 --- a/toolchains/powerpc64le-unknown-linux-gnu.sh +++ b/toolchains/powerpc64le-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.19' CROSS_COMPILE_TRIPLET='powerpc64le-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/s390-unknown-linux-gnu.cmake b/toolchains/s390-unknown-linux-gnu.cmake index 7a07fd5..c769c11 100644 --- a/toolchains/s390-unknown-linux-gnu.cmake +++ b/toolchains/s390-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "s390") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/s390-unknown-linux-gnu.sh b/toolchains/s390-unknown-linux-gnu.sh index 376d8d6..245207c 100644 --- a/toolchains/s390-unknown-linux-gnu.sh +++ b/toolchains/s390-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='s390-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/s390x-unknown-linux-gnu.cmake b/toolchains/s390x-unknown-linux-gnu.cmake index 6af0d68..917bd5c 100644 --- a/toolchains/s390x-unknown-linux-gnu.cmake +++ b/toolchains/s390x-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "s390x") +set(TARGET_GLIBC "2.19") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/s390x-unknown-linux-gnu.sh b/toolchains/s390x-unknown-linux-gnu.sh index 354975f..4002239 100644 --- a/toolchains/s390x-unknown-linux-gnu.sh +++ b/toolchains/s390x-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.19' CROSS_COMPILE_TRIPLET='s390x-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/sparc-unknown-linux-gnu.cmake b/toolchains/sparc-unknown-linux-gnu.cmake index 95c0bc9..5a0060f 100644 --- a/toolchains/sparc-unknown-linux-gnu.cmake +++ b/toolchains/sparc-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "sparc") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/sparc-unknown-linux-gnu.sh b/toolchains/sparc-unknown-linux-gnu.sh index f96048f..77d3327 100644 --- a/toolchains/sparc-unknown-linux-gnu.sh +++ b/toolchains/sparc-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='sparc-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/toolchains/x86_64-unknown-linux-gnu.cmake b/toolchains/x86_64-unknown-linux-gnu.cmake index c17d840..d928cb6 100644 --- a/toolchains/x86_64-unknown-linux-gnu.cmake +++ b/toolchains/x86_64-unknown-linux-gnu.cmake @@ -1,12 +1,13 @@ set(CMAKE_SYSTEM_NAME "Linux") set(CMAKE_SYSTEM_PROCESSOR "x86_64") +set(TARGET_GLIBC "2.7") set(TOOLCHAIN_PREFIX "${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu") set(TOOLCHAIN_PATH "$ENV{OBGGCC_TOOLCHAIN}") -set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc" CACHE FILEPATH "cc") -set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++" CACHE FILEPATH "c++") +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-gcc" CACHE FILEPATH "cc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}${TARGET_GLIBC}-g++" CACHE FILEPATH "c++") set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar" CACHE FILEPATH "ar") set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib" CACHE FILEPATH "ranlib") set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-strip" CACHE FILEPATH "strip") diff --git a/toolchains/x86_64-unknown-linux-gnu.sh b/toolchains/x86_64-unknown-linux-gnu.sh index 49a4695..63f616b 100644 --- a/toolchains/x86_64-unknown-linux-gnu.sh +++ b/toolchains/x86_64-unknown-linux-gnu.sh @@ -2,10 +2,11 @@ set -eu +TARGET_GLIBC='2.7' CROSS_COMPILE_TRIPLET='x86_64-unknown-linux-gnu' -CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-gcc" -CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-g++" +CC="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-gcc" +CXX="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}${TARGET_GLIBC}-g++" AR="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ar" AS="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-as" LD="${OBGGCC_TOOLCHAIN}/bin/${CROSS_COMPILE_TRIPLET}-ld" diff --git a/tools/builtin_symbols.json b/tools/builtin_symbols.json deleted file mode 100644 index ef680da..0000000 --- a/tools/builtin_symbols.json +++ /dev/null @@ -1,1102 +0,0 @@ -[ - { - "name": "acoshf", - "header": "math" - }, - { - "name": "acoshl", - "header": "math" - }, - { - "name": "acosh", - "header": "math" - }, - { - "name": "asinhf", - "header": "math" - }, - { - "name": "asinhl", - "header": "math" - }, - { - "name": "asinh", - "header": "math" - }, - { - "name": "atanhf", - "header": "math" - }, - { - "name": "atanhl", - "header": "math" - }, - { - "name": "atanh", - "header": "math" - }, - { - "name": "cabsf", - "header": "complex" - }, - { - "name": "cabsl", - "header": "complex" - }, - { - "name": "cabs", - "header": "complex" - }, - { - "name": "cacosf", - "header": "complex" - }, - { - "name": "cacoshf", - "header": "complex" - }, - { - "name": "cacoshl", - "header": "complex" - }, - { - "name": "cacosh", - "header": "complex" - }, - { - "name": "cacosl", - "header": "complex" - }, - { - "name": "cacos", - "header": "complex" - }, - { - "name": "cargf", - "header": "complex" - }, - { - "name": "cargl", - "header": "complex" - }, - { - "name": "carg", - "header": "complex" - }, - { - "name": "casinf", - "header": "complex" - }, - { - "name": "casinhf", - "header": "complex" - }, - { - "name": "casinhl", - "header": "complex" - }, - { - "name": "casinh", - "header": "complex" - }, - { - "name": "casinl", - "header": "complex" - }, - { - "name": "casin", - "header": "complex" - }, - { - "name": "catanf", - "header": "complex" - }, - { - "name": "catanhf", - "header": "complex" - }, - { - "name": "catanhl", - "header": "complex" - }, - { - "name": "catanh", - "header": "complex" - }, - { - "name": "catanl", - "header": "complex" - }, - { - "name": "catan", - "header": "complex" - }, - { - "name": "cbrtf", - "header": "complex" - }, - { - "name": "cbrtl", - "header": "complex" - }, - { - "name": "cbrt", - "header": "complex" - }, - { - "name": "ccosf", - "header": "complex" - }, - { - "name": "ccoshf", - "header": "complex" - }, - { - "name": "ccoshl", - "header": "complex" - }, - { - "name": "ccosh", - "header": "complex" - }, - { - "name": "ccosl", - "header": "complex" - }, - { - "name": "ccos", - "header": "complex" - }, - { - "name": "cexpf", - "header": "complex" - }, - { - "name": "cexpl", - "header": "complex" - }, - { - "name": "cexp", - "header": "complex" - }, - { - "name": "cimagf", - "header": "complex" - }, - { - "name": "cimagl", - "header": "complex" - }, - { - "name": "cimag", - "header": "complex" - }, - { - "name": "clogf", - "header": "complex" - }, - { - "name": "clogl", - "header": "complex" - }, - { - "name": "clog", - "header": "complex" - }, - { - "name": "conjf", - "header": "complex" - }, - { - "name": "conjl", - "header": "complex" - }, - { - "name": "conj", - "header": "complex" - }, - { - "name": "copysignf", - "header": "math" - }, - { - "name": "copysignl", - "header": "math" - }, - { - "name": "copysign", - "header": "math" - }, - { - "name": "cpowf", - "header": "complex" - }, - { - "name": "cpowl", - "header": "complex" - }, - { - "name": "cpow", - "header": "complex" - }, - { - "name": "cprojf", - "header": "complex" - }, - { - "name": "cprojl", - "header": "complex" - }, - { - "name": "cproj", - "header": "complex" - }, - { - "name": "crealf", - "header": "complex" - }, - { - "name": "creall", - "header": "complex" - }, - { - "name": "creal", - "header": "complex" - }, - { - "name": "csinf", - "header": "complex" - }, - { - "name": "csinhf", - "header": "complex" - }, - { - "name": "csinhl", - "header": "complex" - }, - { - "name": "csinh", - "header": "complex" - }, - { - "name": "csinl", - "header": "complex" - }, - { - "name": "csin", - "header": "complex" - }, - { - "name": "csqrtf", - "header": "complex" - }, - { - "name": "csqrtl", - "header": "complex" - }, - { - "name": "csqrt", - "header": "complex" - }, - { - "name": "ctanf", - "header": "complex" - }, - { - "name": "ctanhf", - "header": "complex" - }, - { - "name": "ctanhl", - "header": "complex" - }, - { - "name": "ctanh", - "header": "complex" - }, - { - "name": "ctanl", - "header": "complex" - }, - { - "name": "ctan", - "header": "complex" - }, - { - "name": "erfcf", - "header": "math" - }, - { - "name": "erfcl", - "header": "math" - }, - { - "name": "erfc", - "header": "math" - }, - { - "name": "erff", - "header": "math" - }, - { - "name": "erfl", - "header": "math" - }, - { - "name": "erf", - "header": "math" - }, - { - "name": "exp2f", - "header": "math" - }, - { - "name": "exp2l", - "header": "math" - }, - { - "name": "exp2", - "header": "math" - }, - { - "name": "expm1f", - "header": "math" - }, - { - "name": "expm1l", - "header": "math" - }, - { - "name": "expm1", - "header": "math" - }, - { - "name": "fdimf", - "header": "math" - }, - { - "name": "fdiml", - "header": "math" - }, - { - "name": "fdim", - "header": "math" - }, - { - "name": "fmaf", - "header": "math" - }, - { - "name": "fmal", - "header": "math" - }, - { - "name": "fmaxf", - "header": "math" - }, - { - "name": "fmaxl", - "header": "math" - }, - { - "name": "fmax", - "header": "math" - }, - { - "name": "fma", - "header": "math" - }, - { - "name": "fminf", - "header": "math" - }, - { - "name": "fminl", - "header": "math" - }, - { - "name": "fmin", - "header": "math" - }, - { - "name": "hypotf", - "header": "math" - }, - { - "name": "hypotl", - "header": "math" - }, - { - "name": "hypot", - "header": "math" - }, - { - "name": "ilogbf", - "header": "math" - }, - { - "name": "ilogbl", - "header": "math" - }, - { - "name": "ilogb", - "header": "math" - }, - { - "name": "imaxabs", - "header": "inttypes" - }, - { - "name": "isblank", - "header": "ctype" - }, - { - "name": "iswblank", - "header": "wctype" - }, - { - "name": "lgammaf", - "header": "math" - }, - { - "name": "lgammal", - "header": "math" - }, - { - "name": "lgamma", - "header": "math" - }, - { - "name": "llabs", - "header": "stdlib" - }, - { - "name": "llrintf", - "header": "math" - }, - { - "name": "llrintl", - "header": "math" - }, - { - "name": "llrint", - "header": "math" - }, - { - "name": "llroundf", - "header": "math" - }, - { - "name": "llroundl", - "header": "math" - }, - { - "name": "llround", - "header": "math" - }, - { - "name": "log1pf", - "header": "math" - }, - { - "name": "log1pl", - "header": "math" - }, - { - "name": "log1p", - "header": "math" - }, - { - "name": "log2f", - "header": "math" - }, - { - "name": "log2l", - "header": "math" - }, - { - "name": "log2", - "header": "math" - }, - { - "name": "logbf", - "header": "math" - }, - { - "name": "logbl", - "header": "math" - }, - { - "name": "logb", - "header": "math" - }, - { - "name": "lrintf", - "header": "math" - }, - { - "name": "lrintl", - "header": "math" - }, - { - "name": "lrint", - "header": "math" - }, - { - "name": "lroundf", - "header": "math" - }, - { - "name": "lroundl", - "header": "math" - }, - { - "name": "lround", - "header": "math" - }, - { - "name": "nearbyintf", - "header": "math" - }, - { - "name": "nearbyintl", - "header": "math" - }, - { - "name": "nearbyint", - "header": "math" - }, - { - "name": "nextafterf", - "header": "math" - }, - { - "name": "nextafterl", - "header": "math" - }, - { - "name": "nextafter", - "header": "math" - }, - { - "name": "nexttowardf", - "header": "math" - }, - { - "name": "nexttowardl", - "header": "math" - }, - { - "name": "nexttoward", - "header": "math" - }, - { - "name": "remainderf", - "header": "math" - }, - { - "name": "remainderl", - "header": "math" - }, - { - "name": "remainder", - "header": "math" - }, - { - "name": "remquof", - "header": "math" - }, - { - "name": "remquol", - "header": "math" - }, - { - "name": "remquo", - "header": "math" - }, - { - "name": "rintf", - "header": "math" - }, - { - "name": "rintl", - "header": "math" - }, - { - "name": "rint", - "header": "math" - }, - { - "name": "roundf", - "header": "math" - }, - { - "name": "roundl", - "header": "math" - }, - { - "name": "round", - "header": "math" - }, - { - "name": "scalblnf", - "header": "math" - }, - { - "name": "scalblnl", - "header": "math" - }, - { - "name": "scalbln", - "header": "math" - }, - { - "name": "scalbnf", - "header": "math" - }, - { - "name": "scalbnl", - "header": "math" - }, - { - "name": "scalbn", - "header": "math" - }, - { - "name": "snprintf", - "header": "stdio" - }, - { - "name": "tgammaf", - "header": "math" - }, - { - "name": "tgammal", - "header": "math" - }, - { - "name": "tgamma", - "header": "math" - }, - { - "name": "truncf", - "header": "math" - }, - { - "name": "truncl", - "header": "math" - }, - { - "name": "trunc", - "header": "math" - }, - { - "name": "vfscanf", - "header": "stdio" - }, - { - "name": "vscanf", - "header": "stdio" - }, - { - "name": "vsnprintf", - "header": "stdio" - }, - { - "name": "vsscanf", - "header": "stdio" - }, - { - "name": "_Exit", - "header": "stdlib" - }, - { - "name": "acosf", - "header": "math" - }, - { - "name": "acosl", - "header": "math" - }, - { - "name": "asinf", - "header": "math" - }, - { - "name": "asinl", - "header": "math" - }, - { - "name": "atan2f", - "header": "math" - }, - { - "name": "atan2l", - "header": "math" - }, - { - "name": "atanf", - "header": "math" - }, - { - "name": "atanl", - "header": "math" - }, - { - "name": "ceilf", - "header": "math" - }, - { - "name": "ceill", - "header": "math" - }, - { - "name": "cosf", - "header": "math" - }, - { - "name": "coshf", - "header": "math" - }, - { - "name": "coshl", - "header": "math" - }, - { - "name": "cosl", - "header": "math" - }, - { - "name": "expf", - "header": "math" - }, - { - "name": "expl", - "header": "math" - }, - { - "name": "fabsf", - "header": "math" - }, - { - "name": "fabsl", - "header": "math" - }, - { - "name": "floorf", - "header": "math" - }, - { - "name": "floorl", - "header": "math" - }, - { - "name": "fmodf", - "header": "math" - }, - { - "name": "fmodl", - "header": "math" - }, - { - "name": "frexpf", - "header": "math" - }, - { - "name": "frexpl", - "header": "math" - }, - { - "name": "ldexpf", - "header": "math" - }, - { - "name": "ldexpl", - "header": "math" - }, - { - "name": "log10f", - "header": "math" - }, - { - "name": "log10l", - "header": "math" - }, - { - "name": "logf", - "header": "math" - }, - { - "name": "logl", - "header": "math" - }, - { - "name": "modfl", - "header": "math" - }, - { - "name": "modff", - "header": "math" - }, - { - "name": "powf", - "header": "math" - }, - { - "name": "powl", - "header": "math" - }, - { - "name": "sinf", - "header": "math" - }, - { - "name": "sinhf", - "header": "math" - }, - { - "name": "sinhl", - "header": "math" - }, - { - "name": "sinl", - "header": "math" - }, - { - "name": "sqrtf", - "header": "math" - }, - { - "name": "sqrtl", - "header": "math" - }, - { - "name": "tanf", - "header": "math" - }, - { - "name": "tanhf", - "header": "math" - }, - { - "name": "tanhl", - "header": "math" - }, - { - "name": "tanl", - "header": "math" - }, - { - "name": "abs", - "header": "stdlib" - }, - { - "name": "acos", - "header": "math" - }, - { - "name": "asin", - "header": "math" - }, - { - "name": "atan2", - "header": "math" - }, - { - "name": "atan", - "header": "math" - }, - { - "name": "ceil", - "header": "math" - }, - { - "name": "cosh", - "header": "math" - }, - { - "name": "cos", - "header": "math" - }, - { - "name": "exp", - "header": "math" - }, - { - "name": "fabs", - "header": "math" - }, - { - "name": "floor", - "header": "math" - }, - { - "name": "fmod", - "header": "math" - }, - { - "name": "frexp", - "header": "math" - }, - { - "name": "isalnum", - "header": "ctype" - }, - { - "name": "isalpha", - "header": "ctype" - }, - { - "name": "iscntrl", - "header": "ctype" - }, - { - "name": "isdigit", - "header": "ctype" - }, - { - "name": "isgraph", - "header": "ctype" - }, - { - "name": "islower", - "header": "ctype" - }, - { - "name": "isprint", - "header": "ctype" - }, - { - "name": "ispunct", - "header": "ctype" - }, - { - "name": "isspace", - "header": "ctype" - }, - { - "name": "isupper", - "header": "ctype" - }, - { - "name": "isxdigit", - "header": "ctype" - }, - { - "name": "ldexp", - "header": "math" - }, - { - "name": "log10", - "header": "math" - }, - { - "name": "log", - "header": "math" - }, - { - "name": "labs", - "header": "stdlib" - }, - { - "name": "modf", - "header": "math" - }, - { - "name": "pow", - "header": "math" - }, - { - "name": "sinh", - "header": "math" - }, - { - "name": "sin", - "header": "math" - }, - { - "name": "sqrt", - "header": "math" - }, - { - "name": "tanh", - "header": "math" - }, - { - "name": "tan", - "header": "math" - }, - { - "name": "calloc", - "header": "stdlib" - }, - { - "name": "exit", - "header": "stdlib" - }, - { - "name": "fprintf", - "header": "stdio" - }, - { - "name": "fputs", - "header": "stdio" - }, - { - "name": "free", - "header": "stdlib" - }, - { - "name": "fscanf", - "header": "stdio" - }, - { - "name": "malloc", - "header": "stdlib" - }, - { - "name": "printf", - "header": "stdio" - }, - { - "name": "putchar", - "header": "stdio" - }, - { - "name": "puts", - "header": "stdio" - }, - { - "name": "realloc", - "header": "stdlib" - }, - { - "name": "scanf", - "header": "stdio" - }, - { - "name": "snprintf", - "header": "stdio" - }, - { - "name": "sprintf", - "header": "stdio" - }, - { - "name": "sscanf", - "header": "stdio" - }, - { - "name": "vfprintf", - "header": "stdio" - }, - { - "name": "vprintf", - "header": "stdio" - }, - { - "name": "vsprintf", - "header": "stdio" - } -] \ No newline at end of file diff --git a/tools/gcc-wrapper/filesystem.c b/tools/gcc-wrapper/filesystem.c new file mode 100644 index 0000000..7fd943e --- /dev/null +++ b/tools/gcc-wrapper/filesystem.c @@ -0,0 +1,26 @@ +#include +#include + +#include + +char* get_app_filename(void) { + /* + Returns the filename of the application's executable. + + Returns a null pointer on error. + */ + + char* app_filename = malloc(PATH_MAX); + + if (app_filename == NULL) { + return NULL; + } + + if (readlink("/proc/self/exe", app_filename, PATH_MAX) == -1) { + free(app_filename); + return NULL; + } + + return app_filename; + +} diff --git a/tools/gcc-wrapper/filesystem.h b/tools/gcc-wrapper/filesystem.h new file mode 100644 index 0000000..0c16add --- /dev/null +++ b/tools/gcc-wrapper/filesystem.h @@ -0,0 +1,6 @@ +#if !defined(FILESYSTEM_H) +#define FILESYSTEM_H + +char* get_app_filename(void); + +#endif diff --git a/tools/gcc-wrapper/main.c b/tools/gcc-wrapper/main.c new file mode 100644 index 0000000..b5d16bf --- /dev/null +++ b/tools/gcc-wrapper/main.c @@ -0,0 +1,198 @@ +#include +#include +#include +#include + +#include + +#include "filesystem.h" +#include "path.h" +#include "pathsep.h" + +#define GCC "gcc" +#define GPLUSPLUS "g++" + +int main(int argc, char* argv[], char* envp[]) { + + int status = EXIT_SUCCESS; + size_t size = 0; + + char** args = NULL; + char* arg = NULL; + + const char* cc = NULL; + const char* start = NULL; + const char* ptr = NULL; + + char* executable = NULL; + + char* sysroot_directory = NULL; + char* parent_directory = NULL; + + char* fname = NULL; + char* app_filename = NULL; + + char* triplet = NULL; + char* glibc_version = NULL; + + app_filename = get_app_filename(); + + if (app_filename == NULL) { + fprintf(stderr, "fatal error: could not get app filename\n"); + + status = EXIT_FAILURE; + goto end; + } + + fname = basename(app_filename); + + parent_directory = malloc(strlen(app_filename) + 1); + + if (parent_directory == NULL) { + fprintf(stderr, "fatal error: could not allocate memory\n"); + + status = EXIT_FAILURE; + goto end; + } + + get_parent_directory(app_filename, parent_directory, 1); + + ptr = strchr(fname, '\0'); + cc = ptr - 3; + + if (!(strcmp(cc, GCC) == 0 || strcmp(cc, GPLUSPLUS) == 0)) { + fprintf(stderr, "fatal error: unknown GCC compiler: %s\n", cc); + + status = EXIT_FAILURE; + goto end; + } + + ptr = fname; + + while (1) { + const unsigned char a = *ptr; + const unsigned char b = *(ptr + 1); + + if (isdigit(a) && b == '.') { + break; + } + + ptr++; + } + + size = (size_t) (ptr - fname); + + triplet = malloc(size + 1); + + if (triplet == NULL) { + fprintf(stderr, "fatal error: could not allocate memory\n"); + + status = EXIT_FAILURE; + goto end; + } + + memcpy(triplet, fname, size); + triplet[size] = '\0'; + + start = ptr; + + while (1) { + const unsigned char a = *ptr; + + if (a == '-') { + break; + } + + ptr++; + } + + size = (size_t) (ptr - start); + + glibc_version = malloc(size + 1); + + if (glibc_version == NULL) { + fprintf(stderr, "fatal error: could not allocate memory\n"); + + status = EXIT_FAILURE; + goto end; + } + + memcpy(glibc_version, start, size); + glibc_version[size] = '\0'; + + executable = malloc(strlen(parent_directory) + strlen(PATHSEP) + strlen(triplet) + 1 + strlen(cc) + 1); + + if (executable == NULL) { + fprintf(stderr, "fatal error: could not allocate memory\n"); + + status = EXIT_FAILURE; + goto end; + } + + strcpy(executable, parent_directory); + strcat(executable, PATHSEP); + strcat(executable, triplet); + strcat(executable, "-"); + strcat(executable, cc); + + get_parent_directory(app_filename, parent_directory, 2); + + sysroot_directory = malloc(strlen(parent_directory) + strlen(PATHSEP) + strlen(triplet) + strlen(glibc_version) + 1); + + if (sysroot_directory == NULL) { + fprintf(stderr, "fatal error: could not allocate memory\n"); + + status = EXIT_FAILURE; + goto end; + } + + strcpy(sysroot_directory, parent_directory); + strcat(sysroot_directory, PATHSEP); + strcat(sysroot_directory, triplet); + strcat(sysroot_directory, glibc_version); + + args = malloc(sizeof(char*) * (argc + 2)); + + if (args == NULL) { + fprintf(stderr, "fatal error: could not allocate memory\n"); + + status = EXIT_FAILURE; + goto end; + } + + arg = malloc(10 + strlen(sysroot_directory) + 1); + + if (arg == NULL) { + fprintf(stderr, "fatal error: could not allocate memory\n"); + + status = EXIT_FAILURE; + goto end; + } + + strcpy(arg, "--sysroot="); + strcat(arg, sysroot_directory); + + args[0] = executable; + args[1] = arg; + + memcpy(&args[2], &argv[1], argc * sizeof(*argv)); + + if (execve(executable, args, envp) == -1) { + status = EXIT_FAILURE; + goto end; + } + + end:; + + free(triplet); + free(glibc_version); + free(executable); + free(sysroot_directory); + free(app_filename); + free(args); + free(arg); + + return status; + +} + diff --git a/tools/gcc-wrapper/path.c b/tools/gcc-wrapper/path.c new file mode 100644 index 0000000..ea8ef0a --- /dev/null +++ b/tools/gcc-wrapper/path.c @@ -0,0 +1,93 @@ +#include +#include +#include + +#include "path.h" +#include "pathsep.h" + +static int isabsolute(const char* const path) { + + const int status = (*path == *PATHSEP); + return status; + +} + +char* basename(const char* const path) { + /* + Returns the final component of a path. + */ + + char* last_comp = (char*) path; + + while (1) { + char* slash_at = strchr(last_comp, PATHSEP[0]); + + if (slash_at == NULL) { + break; + } + + last_comp = slash_at + 1; + } + + return last_comp; + +} + +size_t get_parent_directory(const char* const source, char* const destination, const size_t maxdepth) { + /* + Get the parent directory up to the specified "maxdepth" depth of a path. + + Returns: + + - If the "destination" parameter is NULL, this will return the required size + for the buffer (not including the null-terminator). + + - If the "destination" parameter is not NULL, this will return the number of + characters written into the buffer (not including the null-terminator). + */ + + size_t index = 0; + size_t depth = 1; + size_t wsize = 0; + + if (destination != NULL) { + destination[0] = '\0'; + } + + for (index = strlen(source) - 1; index-- > 0;) { + const char ch = source[index]; + + if (ch == PATHSEP[0] && depth++ == maxdepth) { + const size_t size = (size_t) ((source + index) - source); + + if (destination != NULL) { + if (size > 0) { + memcpy(destination, source, size); + destination[size] = '\0'; + } else { + strcat(destination, PATHSEP); + } + } + + wsize += (size > 0) ? size : 1; + + break; + } + + if (index == 0 && isabsolute(source)) { + const size_t size = 1; + + wsize += size; + + if (destination != NULL) { + memcpy(destination, source, size); + destination[size] = '\0'; + } + + break; + } + } + + return wsize; + +} diff --git a/tools/gcc-wrapper/path.h b/tools/gcc-wrapper/path.h new file mode 100644 index 0000000..4ea024d --- /dev/null +++ b/tools/gcc-wrapper/path.h @@ -0,0 +1,7 @@ +#if !defined(PATH_H) +#define PATH_H + +char* basename(const char* const path); +size_t get_parent_directory(const char* const source, char* const destination, const size_t depth); + +#endif diff --git a/tools/gcc-wrapper/pathsep.h b/tools/gcc-wrapper/pathsep.h new file mode 100644 index 0000000..8b30bf4 --- /dev/null +++ b/tools/gcc-wrapper/pathsep.h @@ -0,0 +1,6 @@ +#if !defined(PATHSEP_H) +#define PATHSEP_H + +static const char PATHSEP[] = "/"; + +#endif diff --git a/tools/make_builtins.py b/tools/make_builtins.py deleted file mode 100644 index 1cb9b33..0000000 --- a/tools/make_builtins.py +++ /dev/null @@ -1,131 +0,0 @@ -import json -import os -import subprocess -import tempfile -import shutil - -headers = ( - "math", - "stdio", - "complex", - "stdlib", - "ctype", - "wctype", - "inttypes" -) - -source = """\ -#include <%s.h> - -int main(void) { - (void) %s; - return 0; -} -""" - -destination = """\ -/* This file is auto generated. */ -%s -""" - -temporary_file = os.path.join(tempfile.gettempdir(), "main.c") - -symbols_file = os.path.join( - os.path.dirname(p = __file__), - "builtin_symbols.json" -) - -class Builtins: - - def __init__(self): - self.math = [] - self.stdio = [] - self.complex = [] - self.stdlib = [] - self.ctype = [] - self.wctype = [] - self.inttypes = [] - -content = None - -cc = os.getenv(key = "CC") -c_include_path = os.getenv(key = "C_INCLUDE_PATH") - -assert cc is not None -assert c_include_path is not None - -def check_symbols_exists(symbol): - - (name, header) = (symbol["name"], symbol["header"]) - - text = source % (header, name) - - with open(file = temporary_file, mode = "w") as file: - file.write(text) - - process = subprocess.run([cc, "-std=c11", "-w", "-fno-builtin", temporary_file, "-o", "%s.o" % temporary_file]) - - return process.returncode == 0 - -def dump_builtins(builtins, name): - - s = "" - - items = getattr(builtins, name) - - if not items: - return None - - items.sort() - - for item in items: - s += ("\n#if !defined(%s)\n#define %s __builtin_%s\n#endif\n" % (item, item, item)) - - dump = destination % ( - s - ) - - with open(file = "builtin_%s.h" % (name), mode = "w") as file: - file.write(dump) - -with open(file = symbols_file, mode = "r") as file: - content = file.read() - -symbols = json.loads(s = content) - -builtins = Builtins() - -for symbol in symbols: - exists = check_symbols_exists(symbol = symbol) - - if exists: - continue - - (name, header) = ( - symbol["name"], - symbol["header"] - ) - - items = getattr(builtins, header) - items.append(name) - -for name in headers: - dump_builtins(builtins = builtins, name = name) - - src = "builtin_%s.h" % (name) - dst = os.path.join(c_include_path, "%s.h" % (name)) - - if not os.path.exists(path = src): - continue - - print("- Modifying '%s'" % (dst)) - - with open(file = dst, mode = "a+") as file: - file.write("\n\n#include <%s>" % (src)) - - dst = os.path.join(c_include_path, src) - - if os.path.exists(path = dst): - os.remove(dst) - - shutil.move(src = src, dst = dst)