svn commit: r319631 - stable/10/lib/clang

Dimitry Andric dim at FreeBSD.org
Tue Jun 6 18:40:16 UTC 2017


Author: dim
Date: Tue Jun  6 18:40:14 2017
New Revision: 319631
URL: https://svnweb.freebsd.org/changeset/base/319631

Log:
  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.

Modified:
  stable/10/lib/clang/clang.build.mk

Modified: stable/10/lib/clang/clang.build.mk
==============================================================================
--- stable/10/lib/clang/clang.build.mk	Tue Jun  6 17:27:41 2017	(r319630)
+++ stable/10/lib/clang/clang.build.mk	Tue Jun  6 18:40:14 2017	(r319631)
@@ -31,9 +31,14 @@ TARGET_TRIPLE?=	${TARGET_ARCH:C/amd64/x86_64/}-${TARGE
 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}


More information about the svn-src-all mailing list