[swift-dev] Build Error: Relocation R_X86_64_PC32

Dmitri Gribenko gribozavr at gmail.com
Mon Feb 29 22:16:35 CST 2016

IIRC there is no issue in the bug tracker, please feel free to file one!

Also, if you are familiar with binutils internals, it might be helpful
to bisect the linker.

Meador Inge has also mentioned this bug:

Right now, it does not seem clear to me that we have an understanding
what the issue is, which component is broken (LLVM, Swift's IRGen, or
binutils), and if the breakage was accidental or intentional (e.g., to
fix something else).

Previous thread on this topic:



On Mon, Feb 29, 2016 at 8:04 PM, Ryan Lovelett
<swift-dev at ryan.lovelett.me> wrote:
> Perfect.
> That corresponds with what I am seeing. On the morning of the 22nd (when
> it built fine) it used binutils-2.25.1-3 and then on the morning of the
> 23rd (when it failed) it used binutils-2.26-1.
> I'll look into the build flag for the gold linker
> Out of curiosity is there a issue in the bug tracker for this that I
> could follow; or should I file one?
> Thanks again for the quick response.
> On Mon, Feb 29, 2016, at 10:55 PM, Dmitri Gribenko wrote:
>> On Mon, Feb 29, 2016 at 7:51 PM, Ryan Lovelett via swift-dev
>> <swift-dev at swift.org> wrote:
>> > I have a daily build of Swift that I make on a Arch Linux box. On the
>> > morning of February 23rd the build starting failing with the following
>> > error:
>> >
>> > /usr/bin/ld: stdlib/public/core/linux/x86_64/Swift.o: relocation
>> > R_X86_64_PC32 against protected symbol `_TMPSa' can not be used when
>> > making a shared object
>> > /usr/bin/ld: final link failed: Bad value
>> > clang-3.7: error: linker command failed with exit code 1 (use -v to see
>> > invocation)
>> Hi Ryan,
>> If you are running binutils 2.26, this is a known issue.  A workaround
>> is to use the gold linker (build-script-impl has an option for this).
>> Dmitri
>> --
>> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
>> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-dev mailing list