Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 May 2012 17:13:37 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r235133 - in head: contrib/binutils/ld/emultempl share/mk
Message-ID:  <201205071713.q47HDbri074562@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Mon May  7 17:13:36 2012
New Revision: 235133
URL: http://svn.freebsd.org/changeset/base/235133

Log:
  Revert r234656, and apply a proper fix for binutils PR 10474, which
  caused linking clang on 32-bit PowerPC to fail with "relocation
  truncated to fit: R_PPC_REL24" errors.
  
  Original diffs (relicensed under GPLv2 with permission from author):
  http://sourceware.org/git/?p=binutils.git;a=commit;h=1fd262ff7d7ea5adf4894c6b960e092e7e43e3cd
  http://sourceware.org/git/?p=binutils.git;a=commit;h=053c49fbff58bd33bd0d12200ea61302f92caceb
  
  Tested by:	andreast
  MFC after:	1 week

Modified:
  head/contrib/binutils/ld/emultempl/ppc32elf.em
  head/share/mk/bsd.own.mk

Modified: head/contrib/binutils/ld/emultempl/ppc32elf.em
==============================================================================
--- head/contrib/binutils/ld/emultempl/ppc32elf.em	Mon May  7 15:41:31 2012	(r235132)
+++ head/contrib/binutils/ld/emultempl/ppc32elf.em	Mon May  7 17:13:36 2012	(r235133)
@@ -119,7 +119,40 @@ ppc_before_allocation (void)
 	    }
 	}
     }
+
   gld${EMULATION_NAME}_before_allocation ();
+
+  /* Turn on relaxation if executable sections have addresses that
+     might make branches overflow.  */
+  if (!command_line.relax)
+    {
+      bfd_vma low = (bfd_vma) -1;
+      bfd_vma high = 0;
+      asection *o;
+
+      /* Run lang_size_sections (if not already done).  */
+      if (expld.phase != lang_mark_phase_enum)
+	{
+	  expld.phase = lang_mark_phase_enum;
+	  expld.dataseg.phase = exp_dataseg_none;
+	  one_lang_size_sections_pass (NULL, FALSE);
+	  lang_reset_memory_regions ();
+	}
+
+      for (o = output_bfd->sections; o != NULL; o = o->next)
+	{
+	  if ((o->flags & (SEC_ALLOC | SEC_CODE)) != (SEC_ALLOC | SEC_CODE))
+	    continue;
+	  if (o->rawsize == 0)
+	    continue;
+	  if (low > o->vma)
+	    low = o->vma;
+	  if (high < o->vma + o->rawsize - 1)
+	    high = o->vma + o->rawsize - 1;
+	}
+      if (high > low && high - low > (1 << 25) - 1)
+	command_line.relax = TRUE;
+    }
 }
 
 EOF

Modified: head/share/mk/bsd.own.mk
==============================================================================
--- head/share/mk/bsd.own.mk	Mon May  7 15:41:31 2012	(r235132)
+++ head/share/mk/bsd.own.mk	Mon May  7 17:13:36 2012	(r235133)
@@ -442,8 +442,7 @@ __T=${TARGET_ARCH}
 __T=${MACHINE_ARCH}
 .endif
 # Clang is only for x86 and powerpc right now, by default.
-# XXX: Temporarily disabled for 32-bit powerpc, due to a binutils bug.
-.if ${__T} == "amd64" || ${__T} == "i386" || ${__T} == "powerpc64"
+.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
 __DEFAULT_YES_OPTIONS+=CLANG
 .else
 __DEFAULT_NO_OPTIONS+=CLANG



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