From owner-svn-src-stable@FreeBSD.ORG Thu May 17 10:36:33 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 94355106564A; Thu, 17 May 2012 10:36:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64B5B8FC08; Thu, 17 May 2012 10:36:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4HAaX7x091303; Thu, 17 May 2012 10:36:33 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4HAaXuV091301; Thu, 17 May 2012 10:36:33 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201205171036.q4HAaXuV091301@svn.freebsd.org> From: Dimitry Andric Date: Thu, 17 May 2012 10:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235540 - stable/9/contrib/binutils/ld/emultempl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 May 2012 10:36:33 -0000 Author: dim Date: Thu May 17 10:36:32 2012 New Revision: 235540 URL: http://svn.freebsd.org/changeset/base/235540 Log: MFC r235133: 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 Modified: stable/9/contrib/binutils/ld/emultempl/ppc32elf.em Directory Properties: stable/9/contrib/binutils/ (props changed) Modified: stable/9/contrib/binutils/ld/emultempl/ppc32elf.em ============================================================================== --- stable/9/contrib/binutils/ld/emultempl/ppc32elf.em Thu May 17 10:25:34 2012 (r235539) +++ stable/9/contrib/binutils/ld/emultempl/ppc32elf.em Thu May 17 10:36:32 2012 (r235540) @@ -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