Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jun 2017 18:40:15 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r319631 - stable/10/lib/clang
Message-ID:  <201706061840.v56IeFsx041985@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706061840.v56IeFsx041985>