Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch llvm Excluding Merge-Ins
This is equivalent to a diff from 3c8be3d88b to 03a0bbd8b0
|
2013-08-06
| ||
| 20:00 | Fixed AIX platform naming during collection check-in: 4c71db1e90 user: rkeene tags: trunk | |
| 19:58 | Attempted to update to latest version of LLVM Leaf check-in: 03a0bbd8b0 user: rkeene tags: llvm | |
|
2012-09-03
| ||
| 18:44 | Added start of LLVM/Clang support (which as of version 3.1 does not produce any working compilers as far as I can tell) check-in: 825c8fd29a user: rkeene tags: llvm | |
|
2012-09-02
| ||
| 19:24 | Create new branch named "llvm" check-in: e141bd787f user: rkeene tags: llvm | |
| 19:23 | Began work on adding Java support Leaf check-in: ad10c6064e user: rkeene tags: java-support | |
|
2012-08-09
| ||
| 05:45 |
Updated to GCC 4.6.3
Added support for scripts to validate whether a patch is needed or not check-in: 3c8be3d88b user: rkeene tags: trunk | |
|
2012-07-23
| ||
| 15:53 | Updated to deal with Debian-ized platforms that install certain platform files into /usr/lib/<platform> check-in: 7c00a2a0d5 user: rkeene tags: trunk | |
Changes to build-cc.
| ︙ | ︙ | |||
30 31 32 33 34 35 36 | ## Load configuration file if [ -f "build-cc.conf" ]; then . "build-cc.conf" fi # Tool versions BINUTILS_VERS='2.22' | | | < | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
## Load configuration file
if [ -f "build-cc.conf" ]; then
. "build-cc.conf"
fi
# Tool versions
BINUTILS_VERS='2.22'
CLANG_VERS='3.3'
LLVM_VERS="${CLANG_VERS}"
CRT_VERS="${CLANG_VERS}"
# Start of script
## Initialize default values
use_multilib='1'
use_gnu_ld='1'
use_gnu_as='1'
|
| ︙ | ︙ | |||
93 94 95 96 97 98 99 |
## 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}"
| | | | > | | < | | | | | | | | | | | | | < | | 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 |
## 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}"
### CLANG
if [ "${CLANG_VERS}" = "3.3" ]; then
CLANG_NAME="cfe"
else
CLANG_NAME="clang"
fi
CLANG_URL="http://llvm.org/releases/${CLANG_VERS}/${CLANG_NAME}-${CLANG_VERS}.src.tar.gz"
CLANG_TARBALL="src/${CLANG_NAME}-${CLANG_VERS}.tar.gz"
CLANG_DIR="${CLANG_NAME}-${CLANG_VERS}.src"
### LLVM
LLVM_URL="http://llvm.org/releases/${LLVM_VERS}/llvm-${LLVM_VERS}.src.tar.gz"
LLVM_TARBALL="src/llvm-${LLVM_VERS}.tar.gz"
LLVM_DIR="llvm-${LLVM_VERS}.src"
### Compiler-RT
CRT_URL="http://llvm.org/releases/3.1/compiler-rt-3.1.src.tar.gz"
CRT_TARBALL="src/compiler-rt-${CRT_VERS}.tar.gz"
CRT_DIR="compiler-rt-3.1.src"
## Clean-up
if [ "$1" = "clean" -o "$1" = "distclean" ]; then
rm -rf "${CLANG_DIR}" "${LLVM_DIR}" "${CRT_DIR}" "${BINUTILS_DIR}"
for platform in "${platforms[@]}"; do
rm -rf "llvm-${platform}"
done
for appscript in scripts/* scripts/pre/* scripts/post/*; do
"${appscript}" "clean" >/dev/null 2>/dev/null
done
if [ "$1" = "clean" ]; then
exit 0
fi
fi
if [ "$1" = "distclean" ]; then
rm -f "${CLANG_TARBALL}" "${LLVM_TARBALL}" "${CRT_TARBALL}" "${BINUTILS_TARBALL}"
for appscript in scripts/* scripts/pre/* scripts/post/*; do
"${appscript}" "distclean" >/dev/null 2>/dev/null
done
rmdir src >/dev/null 2>/dev/null
|
| ︙ | ︙ | |||
159 160 161 162 163 164 165 |
CCNAME="$1"
CCDIR="${CCROOT}/${CCNAME}"
## Determine attributes for this compiler
### Per CPU
case "${CCNAME}" in
hppa64-*|hppa1*-)
| | < < < < < < < < < < < < < < < < < < < < < < | | | | 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 |
CCNAME="$1"
CCDIR="${CCROOT}/${CCNAME}"
## Determine attributes for this compiler
### Per CPU
case "${CCNAME}" in
hppa64-*|hppa1*-)
BUILD_CC_LLVM_CONFIGURE_EXTRA="${BUILD_CC_LLVM_CONFIGURE_EXTRA} --disable-libquadmath"
;;
esac
### Per OS
case "${CCNAME}" in
*-hpux*)
#### Default to disabling multilib, will be re-enabled by target if supported
use_multilib='0'
;;
*-freebsd*)
#### Default to disabling multilib, will be re-enabled by target if supported
use_multilib='0'
;;
esac
### Disable optimizations if compiling with GCC older than 4.6
if ${CC:-gcc} --version 2>/dev/null | grep 'gcc' >/dev/null; then
BUILD_CC_LLVM_CONFIGURE_EXTRA="${BUILD_CC_LLVM_CONFIGURE_EXTRA} --with-optimize-option=-O0"
fi
## Determine platform file tarball
PLATFORM_TARBALL="${BUILD_CC_PLATFORMDIR}/${CCNAME}-platform.tar.bz2"
ADDONS_TARBALL="${BUILD_CC_PLATFORMDIR}/platform/${CCNAME}-addons.tar.bz2"
### Install platform files (needed for libgcc)
|
| ︙ | ︙ | |||
232 233 234 235 236 237 238 |
### Set use_multilib authoritatively if possible
if [ -f "${CCDIR}/${CCNAME}/multilib" ]; then
use_multilib="$(cat "${CCDIR}/${CCNAME}/multilib")"
rm -f "${CCDIR}/${CCNAME}/multilib"
fi
### Set C compiler flags from tarball
| | | | | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
### Set use_multilib authoritatively if possible
if [ -f "${CCDIR}/${CCNAME}/multilib" ]; then
use_multilib="$(cat "${CCDIR}/${CCNAME}/multilib")"
rm -f "${CCDIR}/${CCNAME}/multilib"
fi
### Set C compiler flags from tarball
if [ -f "${CCDIR}/${CCNAME}/BUILD_CC_LLVM_CONFIGURE_EXTRA" ]; then
add="$(cat "${CCDIR}/${CCNAME}/BUILD_CC_LLVM_CONFIGURE_EXTRA")"
#### Ensure these flags aren't malicious
##### XXX: TODO: Build the extra flags as an array for safety
if ! echo "${add}" | grep '[;|<>]' >/dev/null; then
BUILD_CC_LLVM_CONFIGURE_EXTRA="${BUILD_CC_LLVM_CONFIGURE_EXTRA} ${add}"
fi
rm -f "${CCDIR}/${CCNAME}/BUILD_CC_LLVM_CONFIGURE_EXTRA"
fi
## Determine stage of build process
STAGE="$2"
### If we have a platform tarball and a stage has not been specified, assume we are at stage 2
if [ -z "${STAGE}" ]; then
|
| ︙ | ︙ | |||
301 302 303 304 305 306 307 |
"../${BINUTILS_DIR}/configure" --target="${CCNAME}" --prefix="${CCDIR}" --disable-nls --with-sysroot="${CCDIR}/${CCNAME}" --with-build-sysroot="${CCDIR}/${CCNAME}"
${MAKE} || exit 1
${MAKE} install || exit 1
) || exit 1
| > | > | | < < | < < | > | | | | < | | < | | | < | < | | | | | | | | | | | | | > | | < | | < < | | | < | < < < | < < < > > | > | | | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
"../${BINUTILS_DIR}/configure" --target="${CCNAME}" --prefix="${CCDIR}" --disable-nls --with-sysroot="${CCDIR}/${CCNAME}" --with-build-sysroot="${CCDIR}/${CCNAME}"
${MAKE} || exit 1
${MAKE} install || exit 1
) || exit 1
if [ "${BUILD_CC_DONT_REMOVE}" != '1' ]; then
rm -rf "binutils-${CCNAME}"
fi
## Compile C compiler (CLANG) if needed
### Prepare fix-ups (stage1)
if [ "${STAGE}" = "stage1" ]; then
true
fi
### If multilib was not requested, disable it
if [ "${use_multilib}" = "0" ]; then
#BUILD_CC_GCC_CONFIGURE_EXTRA="--disable-multilib ${BUILD_CC_GCC_CONFIGURE_EXTRA}"
true
fi
## Compile
(
### Determine if compilation is needed
if [ -f "${CCDIR}/bin/${CCNAME}-gcc" ]; then
if find "${CCDIR}/lib/gcc" -type f -name 'libgcc.a' | grep libgcc >/dev/null; then
if [ "${STAGE}" = "stage1" ]; then
#### A stage1 compiler is available
exit 2
else
#### Determine if a stage2 compiler has been built
if find "${CCDIR}" -type f -name 'libgcc_s.*' | grep libgcc_s >/dev/null; then
exit 2
fi
fi
fi
fi
if [ ! -d "${LLVM_DIR}" ]; then
# Download sources required
download "${CLANG_URL}" "${CLANG_TARBALL}"
download "${LLVM_URL}" "${LLVM_TARBALL}"
download "${CRT_URL}" "${CRT_TARBALL}"
# Extract sources
gzip -dc "${CLANG_TARBALL}" | "${TAR:-tar}" -xf -
gzip -dc "${LLVM_TARBALL}" | "${TAR:-tar}" -xf -
gzip -dc "${CRT_TARBALL}" | "${TAR:-tar}" -xf -
# Arroung sources as needed
rm -rf "${LLVM_DIR}/tools/clang"
rm -rf "${LLVM_DIR}/projects/compiler-rt"
mv "${CLANG_DIR}" "${LLVM_DIR}/tools/clang"
mv "${CRT_DIR}" "${LLVM_DIR}/projects/compiler-rt"
# Apply patches
## Apply patch files
for patchfile in "$(pwd)/patches/llvm"/*.diff; do
patchfile_checkscript="$(echo "${patchfile}" | sed 's@\.diff$@.sh@')"
if [ ! -f "${patchfile}" ]; then
continue
fi
if [ -x "${patchfile_checkscript}" ]; then
if ! "${patchfile_checkscript}" "${LLVM_VERS}"; then
continue
fi
fi
(
echo " * Applying patch ${patchfile}"
cd "${LLVM_DIR}" || exit 1
"${PATCH:-patch}" -p1 < "${patchfile}" || exit 1
) || exit 1
done
## Apply patch scripts
export LLVM_DIR
for script in scripts/llvm/*; do
if [ ! -x "${script}" ]; then
continue
fi
sourcefile="${TMPDIR:-/tmp}/build-cc-sourcefile-$$${RANDOM}${RANDOM}${RANDOM}"
rm -f "${sourcefile}"
"${script}" "${CCNAME}" "${CCDIR}" "${CCDIR}/${CCNAME}" "${STAGE}" "${sourcefile}" || exit 1
if [ -f "${sourcefile}" ]; then
. "${sourcefile}"
rm -f "${sourcefile}"
fi
done
fi
# Build CLANG with shared object support
## Create build directory
rm -rf "llvm-${CCNAME}"
mkdir "llvm-${CCNAME}"
cd "llvm-${CCNAME}" || exit -1
## Update environment so C compiler's build system can find binutils
PATH="${PATH}:${CCDIR}/bin"
export PATH
## Build Compiler
if [ "${STAGE}" = "stage1" ]; then
# XXX: TODO
true
else
### Stage 2 -- the full compiler suite
"../${LLVM_DIR}/configure" --target="${CCNAME}" --prefix="${CCDIR}" --with-default-sysroot="${CCDIR}/${CCNAME}" ${BUILD_CC_LLVM_CONFIGURE_EXTRA}
${MAKE} VERBOSE=1 || exit 1
${MAKE} VERBOSE=1 install || exit 1
fi
)
retval="$?"
### Post stage1 build fixups
if [ "${STAGE}" = "stage1" ]; then
true
fi
### If we exited with failure above, abort
if [ "${retval}" != "2" -a "${retval}" != "0" ]; then
exit 1
fi
if [ "${BUILD_CC_DONT_REMOVE}" != '1' ]; then
rm -rf "llvm-${CCNAME}"
fi
## Install libraries for this platform
for appscript in scripts/* scripts/post/*; do
if echo "${appscripts}" | grep '/common$' >/dev/null; then
continue
fi
if [ ! -f "${appscript}" -o ! -x "${appscript}" ]; then
continue
fi
(
PATH="${PATH}:${CCDIR}/bin"
CC="${CCNAME}-cc"
LD="${CCNAME}-ld"
CXX="${CCNAME}-c++"
AR="${CCNAME}-ar"
STRIP="${CCNAME}-strip"
RANLIB="${CCNAME}-ranlib"
export PATH CC LD CXX AR STRIP RANLIB
"${appscript}" "${CCNAME}" "${CCDIR}" "${CCDIR}/${CCNAME}" "${STAGE}" || exit 1
) || exit 1
|
| ︙ | ︙ |