Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Many updates |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
71230f71d039a09740e79b71fc157818 |
| User & Date: | rkeene 2023-10-06 19:40:48 |
Context
|
2023-10-06
| ||
| 19:41 | glibc cleanups check-in: a33cb7caf7 user: rkeene tags: trunk | |
| 19:40 | Many updates check-in: 71230f71d0 user: rkeene tags: trunk | |
|
2019-05-10
| ||
| 17:08 | A bit more work to ensure that some flags are preserved until the right stage check-in: 033a6f4cd4 user: rkeene tags: trunk | |
Changes
Changes to .fossil-settings/ignore-glob.
1 2 3 4 5 6 7 8 9 | platform/*-platform.tar.bz2 src/* binutils-*/* gcc-*/* glibc-*/* linux-*/* musl-*/* yasm-*/* zlib-*/* | > | 1 2 3 4 5 6 7 8 9 10 | platform/*-platform.tar.bz2 src/* binutils-*/* gcc-*/* glibc-*/* linux-*/* musl-*/* yasm-*/* zlib-*/* TMP |
Changes to build-cc.
| ︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 |
CCROOT="${HOME}/root/cross-compilers"
### Path to platform files
if [ -z "${BUILD_CC_PLATFORMDIR}" ]; then
BUILD_CC_PLATFORMDIR="$(pwd)/platform"
fi
## Load configuration file
if [ -f "build-cc.conf" ]; then
. "build-cc.conf"
fi
# Tool versions
| > > > > > < < < < < < < < < < < < < < < < < < < < < < | | | | | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
CCROOT="${HOME}/root/cross-compilers"
### Path to platform files
if [ -z "${BUILD_CC_PLATFORMDIR}" ]; then
BUILD_CC_PLATFORMDIR="$(pwd)/platform"
fi
## Functions
. 'scripts/common'
## Load configuration file
if [ -f "build-cc.conf" ]; then
. "build-cc.conf"
fi
export BUILD_CC_DOWNLOAD_HELPER BUILD_CC_PLATFORMDIR CCROOT
# Tool versions
if [ -z "${BINUTILS_VERS}" ]; then
BINUTILS_VERS='2.41'
fi
if [ -z "${GCC_VERS}" ]; then
GCC_VERS='13.2.0'
fi
if [ -z "${GMP_VERS}" ]; then
GMP_VERS='6.3.0'
fi
if [ -z "${MPFR_VERS}" ]; then
MPFR_VERS='4.2.1'
fi
if [ -z "${MPC_VERS}" ]; then
MPC_VERS='1.3.1'
fi
# Start of script
## Initialize default values
use_multilib="${BUILD_CC_MULTILIB_DEFAULT:-1}"
use_gnu_ld='1'
use_gnu_as='1'
|
| ︙ | ︙ | |||
157 158 159 160 161 162 163 |
platformProfileScript="${TOPDIR}/platform/${platform}.sh"
if [ -f "${platformProfileScript}" ]; then
. "${platformProfileScript}"
fi
## URLs
### Binutils
| < | < < | < < | < < | < < | < > > > > > | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
platformProfileScript="${TOPDIR}/platform/${platform}.sh"
if [ -f "${platformProfileScript}" ]; then
. "${platformProfileScript}"
fi
## URLs
### Binutils
BINUTILS_URL="http://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERS}.tar.bz2"
BINUTILS_TARBALL="src/binutils-${BINUTILS_VERS}.tar.bz2"
BINUTILS_DIR="binutils-${BINUTILS_VERS}"
BINUTILS_HASH="${tool_hash[$(basename "${BINUTILS_TARBALL}")]}"
### GCC
GCC_URL="http://mirrors.kernel.org/gnu/gcc/gcc-${GCC_VERS}/gcc-${GCC_VERS}.tar.xz"
GCC_TARBALL="src/gcc-${GCC_VERS}.tar.xz"
GCC_DIR="gcc-${GCC_VERS}"
GCC_HASH="${tool_hash[$(basename "${GCC_TARBALL}")]}"
### GMP
GMP_URL="http://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERS}.tar.bz2"
GMP_TARBALL="src/gmp-${GMP_VERS}.tar.bz2"
GMP_DIR="gmp-$(echo "${GMP_VERS}" | sed 's@[a-zA-Z]*$@@')"
GMP_HASH="${tool_hash[$(basename "${GMP_TARBALL}")]}"
### MPFR
MPFR_URL="http://www.mpfr.org/mpfr-${MPFR_VERS}/mpfr-${MPFR_VERS}.tar.xz"
MPFR_TARBALL="src/mpfr-${MPFR_VERS}.tar.xz"
MPFR_DIR="mpfr-${MPFR_VERS}"
MPFR_HASH="${tool_hash[$(basename "${MPFR_TARBALL}")]}"
### MPC
MPC_URL="https://ftp.gnu.org/gnu/mpc/mpc-${MPC_VERS}.tar.gz"
MPC_TARBALL="src/mpc-${MPC_VERS}.tar.gz"
MPC_DIR="mpc-${MPC_VERS}"
MPC_HASH="${tool_hash[$(basename "${MPC_TARBALL}")]}"
## Load configuration file again to overwrite any URLs we just set
if [ -f "build-cc.conf" ]; then
. "build-cc.conf"
fi
## Clean-up
if [ "$1" = "clean" -o "$1" = "distclean" ]; then
rm -rf "${BINUTILS_DIR}" "${GCC_DIR}" "${GMP_DIR}" "${MPFR_DIR}" "${MPC_DIR}"
for platform in "${platforms[@]}"; do
rm -rf "gcc-${platform}"
|
| ︙ | ︙ | |||
219 220 221 222 223 224 225 |
fi
fi
if [ "$1" = "distclean" ]; then
rm -f "${BINUTILS_TARBALL}" "${GCC_TARBALL}" "${GMP_TARBALL}" "${MPFR_TARBALL}" "${MPC_TARBALL}"
for appscript in scripts/* scripts/pre/* scripts/post/*; do
| > > > > | < < < | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
fi
fi
if [ "$1" = "distclean" ]; then
rm -f "${BINUTILS_TARBALL}" "${GCC_TARBALL}" "${GMP_TARBALL}" "${MPFR_TARBALL}" "${MPC_TARBALL}"
for appscript in scripts/* scripts/pre/* scripts/post/*; do
if [ ! -f "${appscript}" ]; then
continue
fi
"${appscript}" "distclean"
done
rmdir src >/dev/null 2>/dev/null
exit 0
fi
## Tools
MAKE="${MAKE:-make}"
BUILD_CC_MAKE_FLAGS_SINGLE="$(echo " ${BUILD_CC_MAKE_FLAGS} " | sed 's@ -j *[0-9][0-9]* @ @g;s@^ *@@g;s@ *$@@g')"
export MAKE BUILD_CC_MAKE_FLAGS_SINGLE BUILD_CC_MAKE_FLAGS
## Determine path for this cross-compiler
CCNAME="$1"
CCDIR="${CCROOT}/${CCNAME}"
## Rename GCC directory since it may be patched based on the platform
GCC_DIR="${GCC_DIR}-${CCNAME}"
|
| ︙ | ︙ | |||
425 426 427 428 429 430 431 |
fi
echo " * Building GNU Binutils version ${BINUTILS_VERS} for ${CCNAME}"
if [ ! -d "${BINUTILS_DIR}" ]; then
download "${BINUTILS_URL}" "${BINUTILS_TARBALL}" "${BINUTILS_HASH}" || exit 1
| | | 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
fi
echo " * Building GNU Binutils version ${BINUTILS_VERS} for ${CCNAME}"
if [ ! -d "${BINUTILS_DIR}" ]; then
download "${BINUTILS_URL}" "${BINUTILS_TARBALL}" "${BINUTILS_HASH}" || exit 1
extract "${BINUTILS_TARBALL}" "${BINUTILS_DIR}" || exit 1
# Apply patches
## Apply patch files
for patchfile in "$(pwd)/patches/binutils"/*.diff; do
(
echo " * Applying patch ${patchfile}"
|
| ︙ | ︙ | |||
492 493 494 495 496 497 498 |
fi
fi
fi
fi
echo " * Building GNU C Compiler version ${GCC_VERS} for ${CCNAME}, ${STAGE}"
| | < < < | < < < < < < < | < < < < < < | | | > > > > > > > | > > > > > > > > > | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
fi
fi
fi
fi
echo " * Building GNU C Compiler version ${GCC_VERS} for ${CCNAME}, ${STAGE}"
if [ ! -d "${GCC_DIR}/.ready" ]; then
# Download sources
download "${GCC_URL}" "${GCC_TARBALL}" "${GCC_HASH}" || exit 1
download "${GMP_URL}" "${GMP_TARBALL}" "${GMP_HASH}" || exit 1
download "${MPFR_URL}" "${MPFR_TARBALL}" "${MPFR_HASH}" || exit 1
download "${MPC_URL}" "${MPC_TARBALL}" "${MPC_HASH}" || exit 1
# Extract sources
rm -rf "${GCC_DIR}"
extract "${GCC_TARBALL}" "${GCC_DIR}" || exit 1
extract "${GMP_TARBALL}" "${GCC_DIR}/gmp" || exit 1
extract "${MPFR_TARBALL}" "${GCC_DIR}/mpfr" || exit 1
extract "${MPC_TARBALL}" "${GCC_DIR}/mpc" || exit 1
# Apply patches
## Apply patch files
for patchfile in "$(pwd)/patches/gcc"/*.diff; do
patchfile_checkscript="$(echo "${patchfile}" | sed 's@\.diff$@.sh@')"
patchfile_optional_file="$(echo "${patchfile}" | sed 's@\.diff$@.optional@')"
if [ ! -f "${patchfile}" ]; then
continue
fi
if [ -x "${patchfile_checkscript}" ]; then
if ! "${patchfile_checkscript}" "${GCC_VERS}" "${CCNAME}"; then
continue
fi
fi
patchfile_optional='false'
if [ -f "${patchfile_optional_file}" ]; then
patchfile_optional='true'
fi
(
echo " * Applying patch ${patchfile}"
cd "${GCC_DIR}" || exit 1
"${PATCH:-patch}" --batch --forward -p1 < "${patchfile}"
retval="$?"
if [ "${patchfile_optional}" = 'true' ]; then
exit 0
fi
exit "${retval}"
) || exit 1
done
## Apply patch scripts
export GCC_DIR
for gccscript in scripts/gcc/*; do
if [ ! -x "${gccscript}" ]; then
continue
fi
sourcefile="${TMPDIR:-/tmp}/build-cc-sourcefile-$$${RANDOM}${RANDOM}${RANDOM}"
rm -f "${sourcefile}"
"${gccscript}" "${CCNAME}" "${CCDIR}" "${CCDIR}/${CCNAME}" "${STAGE}" "${sourcefile}" || exit 1
if [ -f "${sourcefile}" ]; then
. "${sourcefile}"
rm -f "${sourcefile}"
fi
done
touch "${GCC_DIR}/.ready"
fi
# Build GCC with shared object support
## Create build directory
rm -rf "gcc-${CCNAME}"
mkdir "gcc-${CCNAME}"
cd "gcc-${CCNAME}" || exit -1
|
| ︙ | ︙ |
Added patches/gcc/gcc-13.2.0-remove-crypt.diff.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
From 9b116160a1482c5c0c199f9c21d78a527d11d9ea Mon Sep 17 00:00:00 2001
From: Fangrui Song <i@maskray.me>
Date: Fri, 28 Apr 2023 09:59:17 -0700
Subject: [PATCH] Remove crypt and crypt_r interceptors
From Florian Weimer's D144073
> On GNU/Linux (glibc), the crypt and crypt_r functions are not part of the main shared object (libc.so.6), but libcrypt (with multiple possible sonames). The sanitizer libraries do not depend on libcrypt, so it can happen that during sanitizer library initialization, no real implementation will be found because the crypt, crypt_r functions are not present in the process image (yet). If its interceptors are called nevertheless, this results in a call through a null pointer when the sanitizer library attempts to forward the call to the real implementation.
>
> Many distributions have already switched to libxcrypt, a library that is separate from glibc and that can be build with sanitizers directly (avoiding the need for interceptors). This patch disables building the interceptor for glibc targets.
Let's remove crypt and crypt_r interceptors (D68431) to fix issues with
newer glibc.
For older glibc, msan will not know that an uninstrumented crypt_r call
initializes `data`, so there is a risk for false positives. However, with some
codebase survey, I think crypt_r uses are very few and the call sites typically
have a `memset(&data, 0, sizeof(data));` anyway.
Fix https://github.com/google/sanitizers/issues/1365
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2169432
Reviewed By: #sanitizers, fweimer, thesamesam, vitalybuka
Differential Revision: https://reviews.llvm.org/D149403
---
.../sanitizer_common_interceptors.inc | 37 -------------------
.../sanitizer_platform_interceptors.h | 2 -
.../sanitizer_platform_limits_posix.cpp | 8 ----
.../sanitizer_platform_limits_posix.h | 1 -
4 files changed, 48 deletions(-)
diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
index ba4b80081f0f..662c41997422 100644
--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
@@ -10187,41 +10187,6 @@ INTERCEPTOR(SSIZE_T, getrandom, void *buf, SIZE_T buflen, unsigned int flags) {
#define INIT_GETRANDOM
#endif
-#if SANITIZER_INTERCEPT_CRYPT
-INTERCEPTOR(char *, crypt, char *key, char *salt) {
- void *ctx;
- COMMON_INTERCEPTOR_ENTER(ctx, crypt, key, salt);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1);
- char *res = REAL(crypt)(key, salt);
- if (res != nullptr)
- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
- return res;
-}
-#define INIT_CRYPT COMMON_INTERCEPT_FUNCTION(crypt);
-#else
-#define INIT_CRYPT
-#endif
-
-#if SANITIZER_INTERCEPT_CRYPT_R
-INTERCEPTOR(char *, crypt_r, char *key, char *salt, void *data) {
- void *ctx;
- COMMON_INTERCEPTOR_ENTER(ctx, crypt_r, key, salt, data);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1);
- char *res = REAL(crypt_r)(key, salt, data);
- if (res != nullptr) {
- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data,
- __sanitizer::struct_crypt_data_sz);
- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
- }
- return res;
-}
-#define INIT_CRYPT_R COMMON_INTERCEPT_FUNCTION(crypt_r);
-#else
-#define INIT_CRYPT_R
-#endif
-
#if SANITIZER_INTERCEPT_GETENTROPY
INTERCEPTOR(int, getentropy, void *buf, SIZE_T buflen) {
void *ctx;
@@ -10772,8 +10737,6 @@ static void InitializeCommonInterceptors() {
INIT_GETUSERSHELL;
INIT_SL_INIT;
INIT_GETRANDOM;
- INIT_CRYPT;
- INIT_CRYPT_R;
INIT_GETENTROPY;
INIT_QSORT;
INIT_QSORT_R;
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h
index 8307b1ec28bf..d50166ee6ce0 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h
@@ -571,8 +571,6 @@
#define SANITIZER_INTERCEPT_FDEVNAME SI_FREEBSD
#define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_ANDROID)
#define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD)
-#define SANITIZER_INTERCEPT_CRYPT (SI_POSIX && !SI_ANDROID)
-#define SANITIZER_INTERCEPT_CRYPT_R (SI_LINUX && !SI_ANDROID)
#define SANITIZER_INTERCEPT_GETRANDOM \
((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD)
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
index c85cf1626a75..bcbd143d19de 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -176,10 +176,6 @@ typedef struct user_fpregs elf_fpregset_t;
# include "sanitizer_platform_interceptors.h"
# include "sanitizer_platform_limits_posix.h"
-#if SANITIZER_INTERCEPT_CRYPT_R
-#include <crypt.h>
-#endif
-
namespace __sanitizer {
unsigned struct_utsname_sz = sizeof(struct utsname);
unsigned struct_stat_sz = sizeof(struct stat);
@@ -283,10 +279,6 @@ namespace __sanitizer {
unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
-#if SANITIZER_INTERCEPT_CRYPT_R
- unsigned struct_crypt_data_sz = sizeof(struct crypt_data);
-#endif
-
#if SANITIZER_LINUX && !SANITIZER_ANDROID
unsigned struct_timex_sz = sizeof(struct timex);
unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds);
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 44dd3d9e22d1..29ebb304a9ba 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -319,7 +319,6 @@ extern unsigned struct_msqid_ds_sz;
extern unsigned struct_mq_attr_sz;
extern unsigned struct_timex_sz;
extern unsigned struct_statvfs_sz;
-extern unsigned struct_crypt_data_sz;
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
struct __sanitizer_iovec {
--
2.41.0
|
Added patches/gcc/gcc-13.2.0-remove-crypt.sh.
> > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 |
#! /usr/bin/env sh
# XXX:TODO: We should only apply this if we're compiling with GLibc that doesn't provide this
GCC_VERS="$1"
case "${GCC_VERS}" in
13.*)
exit 0
;;
esac
exit 1
|
Changes to patches/gcc/gcc-4.9.2-armthumbgmp.sh.
1 2 3 4 5 |
#! /usr/bin/env sh
GCC_VERS="$1"
case "${GCC_VERS}" in
| | | 1 2 3 4 5 6 7 8 9 10 11 |
#! /usr/bin/env sh
GCC_VERS="$1"
case "${GCC_VERS}" in
4.9.[012])
exit 0
;;
esac
exit 1
|
Added patches/gcc/gcc-4.9.3-newergcc.diff.
> > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 |
diff -uNr gcc-4.9.3.orig/gcc/reload.h gcc-4.9.3-newergcc/gcc/reload.h
--- gcc-4.9.3.orig/gcc/reload.h 2014-01-02 16:23:26.000000000 -0600
+++ gcc-4.9.3-newergcc/gcc/reload.h 2023-09-19 15:54:53.430074998 -0500
@@ -166,7 +166,7 @@
value indicates the level of indirect addressing supported, e.g., two
means that (MEM (MEM (REG n))) is also valid if (REG n) does not get
a hard register. */
- bool x_spill_indirect_levels;
+ int x_spill_indirect_levels;
/* True if caller-save has been reinitialized. */
bool x_caller_save_initialized_p;
|
Added patches/gcc/gcc-4.9.3-newergcc.optional.
Added patches/gcc/gcc-4.9.3-newergcc.sh.
> > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 |
#! /usr/bin/env sh
# XXX:TODO: We should only apply this if we're compiling with a newer version of GCC
GCC_VERS="$1"
case "${GCC_VERS}" in
4.*)
exit 0
;;
esac
exit 1
|
Added patches/gcc/gcc-4.9.3-ucontext.diff.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
--- a/libgcc/config/aarch64/linux-unwind.h
+++ b/libgcc/config/aarch64/linux-unwind.h
@@ -55,7 +55,7 @@ aarch64_fallback_frame_state (struct _Unwind_Conte
struct rt_sigframe
{
siginfo_t info;
- struct ucontext uc;
+ ucontext_t uc;
};
struct rt_sigframe *rt_;
--- a/libgcc/config/alpha/linux-unwind.h
+++ b/libgcc/config/alpha/linux-unwind.h
@@ -51,7 +51,7 @@ alpha_fallback_frame_state (struct _Unwind_Context
{
struct rt_sigframe {
siginfo_t info;
- struct ucontext uc;
+ ucontext_t uc;
} *rt_ = context->cfa;
sc = &rt_->uc.uc_mcontext;
}
--- a/libgcc/config/bfin/linux-unwind.h
+++ b/libgcc/config/bfin/linux-unwind.h
@@ -52,7 +52,7 @@ bfin_fallback_frame_state (struct _Unwind_Context
void *puc;
char retcode[8];
siginfo_t info;
- struct ucontext uc;
+ ucontext_t uc;
} *rt_ = context->cfa;
/* The void * cast is necessary to avoid an aliasing warning.
--- a/libgcc/config/i386/linux-unwind.h
+++ b/libgcc/config/i386/linux-unwind.h
@@ -58,7 +58,7 @@ x86_64_fallback_frame_state (struct _Unwind_Contex
if (*(unsigned char *)(pc+0) == 0x48
&& *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL)
{
- struct ucontext *uc_ = context->cfa;
+ ucontext_t *uc_ = context->cfa;
/* The void * cast is necessary to avoid an aliasing warning.
The aliasing warning is correct, but should not be a problem
because it does not alias anything. */
@@ -138,7 +138,7 @@ x86_fallback_frame_state (struct _Unwind_Context *
siginfo_t *pinfo;
void *puc;
siginfo_t info;
- struct ucontext uc;
+ ucontext_t uc;
} *rt_ = context->cfa;
/* The void * cast is necessary to avoid an aliasing warning.
The aliasing warning is correct, but should not be a problem
--- a/libgcc/config/m68k/linux-unwind.h
+++ b/libgcc/config/m68k/linux-unwind.h
@@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respect
/* <sys/ucontext.h> is unfortunately broken right now. */
struct uw_ucontext {
unsigned long uc_flags;
- struct ucontext *uc_link;
+ ucontext_t *uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
unsigned long uc_filler[80];
--- a/libgcc/config/nios2/linux-unwind.h
+++ b/libgcc/config/nios2/linux-unwind.h
@@ -38,7 +38,7 @@ struct nios2_mcontext {
struct nios2_ucontext {
unsigned long uc_flags;
- struct ucontext *uc_link;
+ ucontext_t *uc_link;
stack_t uc_stack;
struct nios2_mcontext uc_mcontext;
sigset_t uc_sigmask; /* mask last for extensibility */
--- a/libgcc/config/pa/linux-unwind.h
+++ b/libgcc/config/pa/linux-unwind.h
@@ -80,7 +80,7 @@ pa32_fallback_frame_state (struct _Unwind_Context
struct sigcontext *sc;
struct rt_sigframe {
siginfo_t info;
- struct ucontext uc;
+ ucontext_t uc;
} *frame;
/* rt_sigreturn trampoline:
--- a/libgcc/config/sh/linux-unwind.h
+++ b/libgcc/config/sh/linux-unwind.h
@@ -82,7 +82,7 @@ sh_fallback_frame_state (struct _Unwind_Context *c
{
struct rt_sigframe {
siginfo_t info;
- struct ucontext uc;
+ ucontext_t uc;
} *rt_ = context->cfa;
/* The void * cast is necessary to avoid an aliasing warning.
The aliasing warning is correct, but should not be a problem
--- a/libgcc/config/tilepro/linux-unwind.h
+++ b/libgcc/config/tilepro/linux-unwind.h
@@ -61,7 +61,7 @@ tile_fallback_frame_state (struct _Unwind_Context
struct rt_sigframe {
unsigned char save_area[C_ABI_SAVE_AREA_SIZE];
siginfo_t info;
- struct ucontext uc;
+ ucontext_t uc;
} *rt_;
/* Return if this is not a signal handler. */
--- a/libgcc/config/xtensa/linux-unwind.h
+++ b/libgcc/config/xtensa/linux-unwind.h
@@ -67,7 +67,7 @@ xtensa_fallback_frame_state (struct _Unwind_Contex
struct rt_sigframe {
siginfo_t info;
- struct ucontext uc;
+ ucontext_t uc;
} *rt_;
/* movi a2, __NR_rt_sigreturn; syscall */
|
Added patches/gcc/gcc-4.9.3-ucontext.sh.
> > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 |
#! /usr/bin/env sh
# XXX:TODO We should only apply this is we're compiling with a newer version of GCC
GCC_VERS="$1"
case "${GCC_VERS}" in
4.*)
exit 0
;;
esac
exit 1
|
Changes to patches/gcc/gcc-5.2.0-cfnsgperf.sh.
1 2 3 4 5 6 |
#! /usr/bin/env sh
GCC_VERS="$1"
CCNAME="$2"
case "${GCC_VERS}" in
| | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#! /usr/bin/env sh
GCC_VERS="$1"
CCNAME="$2"
case "${GCC_VERS}" in
4.9.*)
;;
5.[012].*)
;;
*)
exit 1
;;
esac
exit 0
|
Added patches/gcc/gcc-9.1.0-netbsdctypes.sh.
> > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 |
#! /usr/bin/env sh
GCC_VERS="$1"
case "${GCC_VERS}" in
9.1.*)
exit 0
;;
esac
exit 1
|
Changes to scripts/common.
1 2 3 4 5 6 7 8 9 |
#! /bin/bash
# Functions
function _download_file() {
local file url headers
local header
local try_download_command
local args
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#! /bin/bash
# Tool versions
declare -A tool_hash
tool_hash["binutils-2.25.1.tar.bz2"]='b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22'
tool_hash["binutils-2.25.tar.bz2"]='22defc65cfa3ef2a3395faaea75d6331c6e62ea5dfacfed3e2ec17b08c882923'
tool_hash["binutils-2.29.1.tar.bz2"]='1509dff41369fb70aed23682351b663b56db894034773e6dbf7d5d6071fc55cc'
tool_hash["binutils-2.32.tar.bz2"]='de38b15c902eb2725eac6af21183a5f34ea4634cb0bcef19612b50e5ed31072d'
tool_hash["binutils-2.41.tar.bz2"]='a4c4bec052f7b8370024e60389e194377f3f48b56618418ea51067f67aaab30b'
tool_hash["gcc-4.9.2.tar.bz2"]='2020c98295856aa13fda0f2f3a4794490757fc24bcca918d52cc8b4917b972dd'
tool_hash["gcc-6.2.0.tar.bz2"]='9944589fc722d3e66308c0ce5257788ebd7872982a718aa2516123940671b7c5'
tool_hash["gcc-7.3.0.tar.xz"]='832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c'
tool_hash["gcc-9.1.0.tar.xz"]='79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0'
tool_hash["gcc-13.2.0.tar.xz"]='e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da'
tool_hash["glibc-2.22.tar.gz"]='a62610c4084a0fd8cec58eee12ef9e61fdf809c31e7cecbbc28feb8719f08be5'
tool_hash["glibc-2.26.tar.gz"]='dcc2482b00fdb1c316f385f8180e182bbd37c065dc7d8281a4339d2834ef1be7'
tool_hash["glibc-2.27.tar.gz"]='881ca905e6b5eec724de7948f14d66a07d97bdee8013e1b2a7d021ff5d540522'
tool_hash["glibc-ports-2.16.0.tar.gz"]='1092e81d0c9c1bc29343004c1d01fb0d89eb49dd0fd5339b2f2e64a44b582d10'
tool_hash["gmp-6.0.0a.tar.bz2"]='7f8e9a804b9c6d07164cf754207be838ece1219425d64e28cfa3e70d5c759aaf'
tool_hash["gmp-6.1.2.tar.bz2"]='5275bb04f4863a13516b2f39392ac5e272f5e1bb8057b18aec1c9b79d73d8fb2'
tool_hash["gmp-6.3.0.tar.bz2"]='ac28211a7cfb609bae2e2c8d6058d66c8fe96434f740cf6fe2e47b000d1c20cb'
tool_hash["mpc-1.0.2.tar.gz"]='b561f54d8a479cee3bc891ee52735f18ff86712ba30f036f8b8537bae380c488'
tool_hash["mpc-1.1.0.tar.gz"]='6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e'
tool_hash["mpc-1.3.1.tar.gz"]='ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8'
tool_hash["mpfr-3.1.2.tar.bz2"]='79c73f60af010a30a5c27a955a1d2d01ba095b72537dab0ecaad57f5a7bb1b6b'
tool_hash["mpfr-4.0.0.tar.bz2"]='6aa31fbf3bd1f9f95bcfa241590a9d11cb0f874e2bb93b99c9e2de8eaea6d5fd'
tool_hash["mpfr-4.0.0.tar.xz"]='fbe2cd1418b321f5c899ce4f0f0f4e73f5ecc7d02145b0e1fd096f5c3afb8a1d'
tool_hash["mpfr-4.0.2.tar.xz"]='1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a'
tool_hash["mpfr-4.2.1.tar.xz"]='277807353a6726978996945af13e52829e3abd7a9a5b7fb2793894e18f1fcbb2'
tool_hash["llvm-8.0.0.tar.xz"]='8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c'
tool_hash["clang-8.0.0.tar.xz"]='084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b'
tool_hash["compiler-rt-8.0.0.tar.xz"]='b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1'
# Functions
function _download_file() {
local file url headers
local header
local try_download_command
local args
|
| ︙ | ︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
local checksum dl_checksum checksum_type
local tmpfile
url="$1"
file="$2"
checksum="$3"
if [ -n "${BUILD_CC_DOWNLOAD_HELPER}" ]; then
"${BUILD_CC_DOWNLOAD_HELPER}" "${url}" "${file}" "${checksum}"
return "$?"
fi
checksum_type='unknown'
| > > > > > > > > > > > > > > > > > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
local checksum dl_checksum checksum_type
local tmpfile
url="$1"
file="$2"
checksum="$3"
# If no checksum was provided, try to guess one
if [ -z "${checksum}" ]; then
local tool_name
tool_name="$(echo "${url}" | sed 's@\?.*$@@;s@^.*/@@')"
if [ -n "${tool_hash[${tool_name}]}" ]; then
checksum="${tool_hash[${tool_name}]}"
fi
fi
# Emit a warning if no checksum is provided
if [ -z "${checksum}" ]; then
echo '*********************************************************' >&2
echo "WARNING: Downloading ${url} -> ${file} with no checksum !" >&2
echo '*********************************************************' >&2
fi
# Use the download helper if possible
if [ -n "${BUILD_CC_DOWNLOAD_HELPER}" ]; then
"${BUILD_CC_DOWNLOAD_HELPER}" "${url}" "${file}" "${checksum}"
return "$?"
fi
checksum_type='unknown'
|
| ︙ | ︙ | |||
109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
fi
fi
mv "${tmpfile}" "${file}"
return 0
}
function fix_pkgconfig_file () {
local file
file="$1"
sed 's@^prefix=.*@prefix=/usr@;s@\$(libdir)@${libdir}@g' "${file}" > "${file}.new"
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
fi
fi
mv "${tmpfile}" "${file}"
return 0
}
function extract() {
local tarball outputdir checksum
local tool
local tmpdir tmpname
local outputdirroot
local retval
tarball="$1"
outputdir="$2"
checksum="$3"
if [ -e "${outputdir}" ]; then
return 1
fi
case "${tarball}" in
*.tar.bz2|*.tbz2)
tool='bzip2'
;;
*.tar.xz|*.txz)
tool='xz'
;;
*.tar.gz|*.tgz)
tool='gzip'
;;
*)
echo "error: Unable to extract \"${tarball}\"" >&2
return 1
;;
esac
tmpname="$(basename "${outputdir}")"
outputdirroot="$(dirname "${outputdir}")"
tmpdir="tmp.$(openssl rand -hex 20)" || return 1
mkdir "${tmpdir}" || return 1
mkdir "${tmpdir}/${tmpname}" || return 1
# If the tarball is a URL, download it to a temporary location first
case "${tarball}" in
*://*)
download "${tarball}" "${tmpdir}/archive" "${checksum}"
tarball="${tmpdir}/archive"
;;
esac
"${tool}" -dc "${tarball}" | (
cd "${tmpdir}/${tmpname}" || exit 1
tar -xf - || exit 1
shopt -s dotglob
singledir="$(echo *)"
if [ -e "${singledir}" ]; then
mv "${singledir}" "${tmpdir}" || exit 1
cd "${tmpdir}" || exit 1
mv * .. || exit 1
cd .. || exit 1
rm -rf "${tmpdir}"
fi
) || return 1
retval='1'
mv "${tmpdir}/${tmpname}" "${outputdirroot}" && retval='0'
rm -f "${tmpdir}/archive" || return 1
rmdir "${tmpdir}" || return 1
return "${retval}"
}
function fix_pkgconfig_file () {
local file
file="$1"
sed 's@^prefix=.*@prefix=/usr@;s@\$(libdir)@${libdir}@g' "${file}" > "${file}.new"
|
| ︙ | ︙ |
Changes to scripts/post/02-glibc.
1 2 3 4 5 6 7 8 |
#! /bin/bash
# URLs and versions
if [ -z "${LINUX_VERS}" ]; then
## Keep in sync with 00-linux-kernel
LINUX_VERS='3.2.98'
fi
if [ -z "${GLIBC_VERS}" ]; then
| | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#! /bin/bash
# URLs and versions
if [ -z "${LINUX_VERS}" ]; then
## Keep in sync with 00-linux-kernel
LINUX_VERS='3.2.98'
fi
if [ -z "${GLIBC_VERS}" ]; then
GLIBC_VERS='2.38'
GLIBC_TARBALL_SHA256="16e51e0455e288f03380b436e41d5927c60945abd86d0c9852b84be57dd6ed5e"
fi
if [ -z "${GLIBC_URL}" ]; then
GLIBC_URL="http://ftp.gnu.org/gnu/glibc/glibc-${GLIBC_VERS}.tar.gz"
fi
GLIBC_TARBALL="src/glibc-${GLIBC_VERS}.tar.gz"
GLIBC_DIR="glibc-${GLIBC_VERS}"
|
| ︙ | ︙ | |||
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
done
fi
# Ensure that a stdio.h exists, even if it is blank for autoconf scripts
touch "${PREFIX}/include/stdio.h"
CC_SAVE="${CC}"
rebuild_binutils_needed='0'
for arch in $(multilib); do
CC="${CC_SAVE} $(multilib --cflags "${arch}")"
arch_host="$(multilib --host "${arch}")"
arch_libdir="$(multilib --libdir --noprefix "${arch}")"
if [ -e "${PREFIX}/${arch_libdir}/glibc-${GLIBC_VERS}-completed-${STAGE}" ]; then
continue
fi
| > > | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
done
fi
# Ensure that a stdio.h exists, even if it is blank for autoconf scripts
touch "${PREFIX}/include/stdio.h"
CC_SAVE="${CC}"
CXX_SAVE="${CXX}"
rebuild_binutils_needed='0'
for arch in $(multilib); do
CC="${CC_SAVE} $(multilib --cflags "${arch}")"
CXX="${CXX_SAVE} $(multilib --cflags "${arch}")"
arch_host="$(multilib --host "${arch}")"
arch_libdir="$(multilib --libdir --noprefix "${arch}")"
if [ -e "${PREFIX}/${arch_libdir}/glibc-${GLIBC_VERS}-completed-${STAGE}" ]; then
continue
fi
|
| ︙ | ︙ |
Changes to setup-cc.
1 2 3 4 5 6 7 8 9 10 |
#! /bin/bash
CCROOT="$(dirname "$(which "$0")")"
idx=0
for platform in "${CCROOT}"/*; do
if [ ! -d "${platform}" ]; then
continue
fi
| > > | 1 2 3 4 5 6 7 8 9 10 11 12 |
#! /bin/bash
CCROOT="$(dirname "$(which "$0")")"
COMPILER_C='gcc'
COMPILER_CXX='g++'
idx=0
for platform in "${CCROOT}"/*; do
if [ ! -d "${platform}" ]; then
continue
fi
|
| ︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 |
echo " ${platform}"
done
exit 0
fi
CCNAME="$1"
shift
# Canonicalize symbolic links
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > > | | > | < > > | < < > > > | < > > > > > > > > > > | | > | > | < | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
echo " ${platform}"
done
exit 0
fi
CCNAME="$1"
CCROOT="$(cd "${CCROOT}" && pwd)"
CCDIR="${CCROOT}/${CCNAME}"
shift
function writeCLangWrapper() {
local ccname ccdir
local clang_wrapper clangxx_wrapper
local clang_triplet clang_triplet_arch clang_triplet_vendor clang_triplet_sys clang_triplet_abi
local assemble_clang_triplet
local clang_args
local tmpfile
local gcc
local libdir
ccname="$1"
ccdir="$2"
gcc="${ccdir}/bin/${ccname}-gcc"
if [ -z "${ccname}" -o -z "${ccdir}" ]; then
echo "Usage: writeCLangWrapper <ccname> <ccdir>" >&2
return 1
fi
clang_wrapper="${ccdir}/bin/${ccname}-clang"
clangxx_wrapper="${ccdir}/bin/${ccname}-clang++"
if [ -e "${clang_wrapper}" -a -e "${clangxx_wrapper}" ]; then
return 0
fi
clang_args=()
clang_triplet="${ccname}"
clang_triplet_arch='unknown'
clang_triplet_vendor='unknown'
clang_triplet_sys='unknown'
clang_triplet_abi='unknown'
assemble_clang_triplet='true'
case "${ccname}" in
x86_64-*|sparc-*|arm-*|powerpc-*|aarch64-*|mips-*|mipsel-*|armv[0-9]*-*)
clang_triplet_arch="$(echo "${ccname}" | sed 's@-.*$@@')"
;;
i?86-*)
clang_triplet_arch='i386'
;;
hppa64-*)
clang_triplet_arch='hppa2.0'
;;
*)
assemble_clang_triplet='false'
;;
esac
case "${ccname}" in
*-hardfloat-*)
clang_args+=('-mfloat-abi=hard')
;;
esac
case "${ccname}" in
*-netbsd[0-9]*|*-freebsd[0-9]*|*-solaris[0-9].[0-9]*|*-aix[0-9]*.*|*-hpux[0-9]*|*-darwin[0-9]*)
clang_triplet_sys="$(echo "${ccname}" | sed 's@^.*-@@;s@[0-9].*$@@')"
;;
*-linux-musl)
clang_triplet_sys='linux'
clang_triplet_abi='musl'
;;
*-linux-uclibc)
clang_triplet_sys='linux'
clang_triplet_abi='uclibc'
;;
*-linux-gnu)
clang_triplet_sys='linux'
clang_triplet_abi='gnu'
;;
*-linux-gnueabihf)
clang_triplet_sys='linux'
clang_triplet_abi='eabi'
clang_args+=('-mfloat-abi=hard')
;;
*-linux-gnueabi)
clang_triplet_sys='linux'
clang_triplet_abi='eabi'
;;
*-linux-androideabi)
clang_triplet_sys='linux'
clang_triplet_abi='android'
;;
*-linux)
clang_triplet_sys='linux'
;;
*)
assemble_clang_triplet='false'
;;
esac
if [ "${assemble_clang_triplet}" = 'true' ]; then
clang_triplet="${clang_triplet_arch}-${clang_triplet_vendor}-${clang_triplet_sys}-${clang_triplet_abi}"
clang_triplet="$(echo "${clang_triplet}" | sed 's@-unknown$@@')"
fi
while IFS='' read -d ':' -r libdir; do
if [ -z "${libdir}" ]; then
continue
fi
clang_args+=("-L${libdir}")
done <<<"$("${gcc}" -print-search-dirs 2>/dev/null | grep '^libraries: ' | sed 's@^libraries: *@@;s@$@:@')"
tmpfile="${clang_wrapper}.$(openssl rand 20 -hex)"
echo '#! /usr/bin/env bash' > "${tmpfile}"
echo '' >> "${tmpfile}"
set | egrep '^(clang_triplet|clang_args|ccdir|ccname)=' >> "${tmpfile}"
cat << \_EOF_ >> "${tmpfile}"
exec @TOOL@ -fuse-ld=lld --sysroot "${ccdir}/${ccname}" -target "${clang_triplet}" "${clang_args[@]}" "$@"
_EOF_
sed 's/@TOOL@/clang/g' < "${tmpfile}" > "${tmpfile}.clang" || return 1
sed 's/@TOOL@/clang++/g' < "${tmpfile}" > "${tmpfile}.clang++" || return 1
rm -f "${tmpfile}"
chmod +x "${tmpfile}.clang" "${tmpfile}.clang++"
mv "${tmpfile}.clang" "${clang_wrapper}"
mv "${tmpfile}.clang++" "${clangxx_wrapper}"
return 0
}
# Canonicalize symbolic links
if [ -L "${CCDIR}" ]; then
CCNAME="$(readlink "${CCDIR}" | sed 's@^.*/@@')"
fi
found='0'
for platform in "${platforms[@]}"; do
if [ "${platform}" = "${CCNAME}" ]; then
found='1'
break
fi
done
if [ "${found}" != '1' ]; then
echo "Unknown platform: ${CCNAME}" >&2
exit 1
fi
case "${CCNAME}" in
x86_64-*|hppa64-*|arm64-*|aarch64-*)
have_64bit='1'
;;
*)
have_64bit='0'
;;
esac
want_64bit="${have_64bit}"
CC_ADD=""
ADD_CLANG_PATH=''
for arg in "$@"; do
case "${arg}" in
64|-m64)
want_64bit='1'
;;
32|-m32)
want_64bit='0'
;;
-m*)
# Disable any manual added flags
want_64bit="${have_64bit}"
CC_ADD="${CC_ADD} ${arg}"
;;
-clang)
COMPILER_C='clang'
COMPILER_CXX='clang++'
ADD_CLANG_PATH="$(ls -1d "${CCROOT}"/llvm-*/ | sort | tail -n 1)bin:"
writeCLangWrapper "${CCNAME}" "${CCDIR}"
;;
esac
done
if [ "${have_64bit}" != "${want_64bit}" ]; then
if [ "${want_64bit}" = "1" ]; then
CC_ADD="${CC_ADD} -m64"
else
CC_ADD="${CC_ADD} -m32"
fi
fi
if [ -z "${CC_FOR_BUILD}" -a -z "${HOST_CC}" ]; then
if [ -n "${CC}" ]; then
CC_FOR_BUILD="${CC}"
else
tmpfile="${TMPDIR:-/tmp}/setup-cc-find-cc-$$${RANDOM}${RANDOM}${RANDOM}"
rm -f "${tmpfile}.o" "${tmpfile}"
echo 'int main(int argc, char **argv) { return(0); }' > "${tmpfile}"
for try_cc in cc gcc c89 c99; do
try_cc="$(which "${try_cc}" 2>/dev/null)"
if [ ! -f "${try_cc}" ]; then
continue
fi
rm -f "${tmpfile}"
"${try_cc}" -o "${tmpfile}" "${tmpfile}" 2>/dev/null >/dev/null || continue
"${tmpfile}" 2>/dev/null >/dev/null || continue
CC_FOR_BUILD="${try_cc}"
break
done
rm -f "${tmpfile}.o" "${tmpfile}"
fi
elif [ -z "${CC_FOR_BUILD}" -a -n "${HOST_CC}" ]; then
CC_FOR_BUILD="${HOST_CC}"
fi
echo "PATH='${ADD_CLANG_PATH}${PATH}:${CCROOT}/${CCNAME}/bin';"
echo "AR='${CCNAME}-ar';"
echo "AS='${CCNAME}-as';"
echo "CC='${CCNAME}-${COMPILER_C}${CC_ADD}';"
echo "CXX='${CCNAME}-${COMPILER_CXX}${CC_ADD}';"
echo "LD='${CCNAME}-ld';"
echo "NM='${CCNAME}-nm';"
echo "RANLIB='${CCNAME}-ranlib';"
echo "STRIP='${CCNAME}-strip';"
echo "PKG_CONFIG='${CCNAME}-pkg-config';"
echo "PKGCONFIG='${CCNAME}-pkg-config';"
echo "CC_FOR_BUILD='${CC_FOR_BUILD}';"
echo "HOST_CC='${CC_FOR_BUILD}';"
echo "PKG_CONFIG_DIR='';"
echo "PKG_CONFIG_LIBDIR='${CCROOT}/${CCNAME}/${CCNAME}/lib/pkgconfig';"
echo 'export PATH AR AS CC CXX LD NM RANLIB STRIP PKG_CONFIG PKGCONFIG CC_FOR_BUILD HOST_CC PKG_CONFIG_DIR PKG_CONFIG_LIBDIR;'
|