diff options
author | dim <dim@FreeBSD.org> | 2017-06-06 18:40:14 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2017-06-06 18:40:14 +0000 |
commit | a86354a1193cbe94e40968bb3b147c3ac300817a (patch) | |
tree | 4da43940425bbfe603219577c679058b83204e6d /lib | |
parent | 974a49519d260c1549d6a5e619d1c7a09db823f2 (diff) | |
download | FreeBSD-src-a86354a1193cbe94e40968bb3b147c3ac300817a.zip FreeBSD-src-a86354a1193cbe94e40968bb3b147c3ac300817a.tar.gz |
Work around a gcc 4.2 bug on powerpc architectures, where using
-fdata-sections can cause bogus "section type conflict" errors. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33168 for more information.
Since the upstream fixes are under GPLv3 and non-trivial, just disable
using function and data sections, at the cost of a slightly larger
executable.
Direct commit to stable/10, since the version of clang in head and
stable/11 cannot be built by gcc 4.2 at all.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/clang/clang.build.mk | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/clang/clang.build.mk b/lib/clang/clang.build.mk index 732fa37..6a23820 100644 --- a/lib/clang/clang.build.mk +++ b/lib/clang/clang.build.mk @@ -31,9 +31,14 @@ TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.3 BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.3 CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" \ -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\" \ - -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" \ - -ffunction-sections -fdata-sections + -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" +# Work around gcc 4.2 "section type conflict" bug with -fdata-sections on +# powerpc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33168 +.if !(${MACHINE_CPUARCH} == "powerpc" && ${COMPILER_TYPE} == "gcc" && \ + ${COMPILER_VERSION} < 40300) +CFLAGS+= -ffunction-sections -fdata-sections LDFLAGS+= -Wl,--gc-sections +.endif CXXFLAGS+= -fno-exceptions -fno-rtti .PATH: ${LLVM_SRCS}/${SRCDIR} |