Bug 20173 - LD: Link issue with grantlee 0.5.1
Summary: LD: Link issue with grantlee 0.5.1
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.25
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-28 14:36 UTC by romain.naour
Modified: 2016-06-03 21:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2016-06-02 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description romain.naour 2016-05-28 14:36:14 UTC
Hello,

After fixing the nios2 toolchain with [1] a new build issue appeared with grantlee package [2]

/home/buildroot/autobuild/run/instance-1/output/host/opt/ext-toolchain/bin/../lib/gcc/nios2-buildroot-linux-gnu/4.9.3/../../../../nios2-buildroot-linux-gnu/bin/ld: Further warnings about FDE encoding preventing .eh_frame_hdr generation dropped.
collect2: error: ld returned 1 exit status
make[4]: *** [templates/lib/libgrantlee_core.so.0.5.1] Error 1

ld give no explanation about the failure...
Note sure the build issue is related to PR19405

The same issue appear on microblaze [3]

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=19405
[2] http://autobuild.buildroot.net/results/e05/e05280f1cc4f669b7e418161749290723179e987/build-end.log

[3] http://autobuild.buildroot.net/?reason=grantlee-0.5.1&&arch=microblazeel

Best regards,
Romain Naour
Comment 1 Nick Clifton 2016-06-01 16:01:06 UTC
Hi Romain,

  Hmm, strange.  The intention was that the linker would issue those warning
  messages, but *not* treat them as a failure to link.

  Can you make a small testcase that reproduces the problem, so that I can
  investigate further ?

Cheers
  Nick
Comment 2 romain.naour 2016-06-01 19:55:57 UTC
Hi Nick,

Yes, I understand that PR19405 patch was made to reduce warning messages.

Steps to reproduce:

$ git clone git://git.busybox.net/buildroot
$ cd buildroot
$ git checkout 9acd598bccaab7e5edef5444abf97c840737c5b4
$ wget http://autobuild.buildroot.net/results/e05/e05280f1cc4f669b7e418161749290723179e987/config -O .config
$ make olddefconfig
$ make grantlee

This should reproduce the issue with the same architecture, toolchain etc...
Also, I tried with binutils 2.26 and gcc 5.3 and it fail with the same issue.

Thanks for your help.

Best regards,
Romain
Comment 3 Nick Clifton 2016-06-02 08:30:56 UTC
Hi Romain,

  Ha - found it.  You are linking with "--fatal-warnings" specified on the linker command line.  Hence the warnings about being unable to create a .eh_frame_hdr section are causing the link to fail.

  I am not an expert in your build system, but I suspect that this option is the result of a configure-time option, or possibly the absence of a configure-time option to turn it off.

  I can understand that you might be reluctant to turn this option off, as it would allow other, possibly important, warnings to fly by without necessarily receiving the attention of the programmer.  If that is the case then the only thing that I can suggest is that you do not enable PIC for these libraries. 

  The root cause of the problem is that the nios2 target (and microblaze as well) does not generate PC-relative addresses in its .eh_frame sections, and this makes it impossible to generate the .eh_frame_hdr section.  The warning is intended as a hint to the programmer to let them know why the linker is not doing something that they might otherwise expect.

Cheers
  Nick
Comment 4 romain.naour 2016-06-03 21:31:08 UTC
Hi Nick,

(In reply to Nick Clifton from comment #3)
> Hi Romain,
> 
>   Ha - found it.  You are linking with "--fatal-warnings" specified on the
> linker command line.  Hence the warnings about being unable to create a
> .eh_frame_hdr section are causing the link to fail.

Ha right ! I missed --fatal-warnings flag hardcoded in the grantlee CMakeLists.txt.

> 
>   I am not an expert in your build system, but I suspect that this option is
> the result of a configure-time option, or possibly the absence of a
> configure-time option to turn it off.

Actually, Buildroot itself doesn't turn a warning into error, it's the grantlee build system. I don't think the grantlee developers ever tried to compile with a microblaze or nios2 toolchain.

> 
>   I can understand that you might be reluctant to turn this option off, as
> it would allow other, possibly important, warnings to fly by without
> necessarily receiving the attention of the programmer.  If that is the case
> then the only thing that I can suggest is that you do not enable PIC for
> these libraries.

Well, you're probably right but it's sometime difficult to keep all warnings enabled since in the autobuilders try to build every packages with different kind of toolchains (glibc, uClibc, musl based) and for each CPU architecture Buildroot support. We try to the best effort by resolving each critical build error but leaving warnings aside.

Since you said that this warning is not so serious (PR19405#c5), I'll simply remove this flag from the CMakeLists.txt.

> 
>   The root cause of the problem is that the nios2 target (and microblaze as
> well) does not generate PC-relative addresses in its .eh_frame sections, and
> this makes it impossible to generate the .eh_frame_hdr section.  The warning
> is intended as a hint to the programmer to let them know why the linker is
> not doing something that they might otherwise expect.

Thanks for the explanation, I think nios2 user/programmer should be aware of this.

In the end, this not a linker issue. I'll clone this bug report.

Thanks for your time,

Best regards,
Romain

> 
> Cheers
>   Nick
Comment 5 romain.naour 2016-06-03 21:32:36 UTC
This is not a linker issue.