[swift-dev] Build Error: Relocation R_X86_64_PC32

Ryan Lovelett swift-dev at ryan.lovelett.me
Mon Mar 14 17:38:33 CDT 2016


On Tue, Mar 1, 2016, at 12:16 AM, Dmitri Gribenko wrote:
> 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.

I'm finally getting around to bisecting binutils. I'm making some
progress but I'm getting hung up on one thing. The build script keeps
finding the "regular" linker at `/usr/bin/ld` instead of mine
`/tmp/binutils/2.25/usr/local/bin/ld`.

I tried to update the PATH environment variable such that mine is before
`/usr/bin` but that doesn't seem to work. Is there an argument to send
that can force mine?

> 
> Meador Inge has also mentioned this bug:
> https://llvm.org/bugs/show_bug.cgi?id=26580
> 
> 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:
> 
> https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20160215/001176.html
> https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20160222/001190.html
> 
> Dmitri
> 
> 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>*/
> 
> 
> 
> -- 
> 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>*/


More information about the swift-dev mailing list