This is the mail archive of the
mailing list for the binutils project.
Re: Downgrade linker error on protected symbols in .dynbss to a warning
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>, Richard Henderson <rth at redhat dot com>
- Date: Tue, 14 Apr 2015 11:39:38 +0930
- Subject: Re: Downgrade linker error on protected symbols in .dynbss to a warning
- Authentication-results: sourceware.org; auth=none
- References: <20150410115859 dot GM27812 at bubble dot grove dot modra dot org> <CAMe9rOrppvHdxMm-3x=7XaJQzW50dT4jkO-DRWRJxYhTtU6OPw at mail dot gmail dot com> <20150410132126 dot GN27812 at bubble dot grove dot modra dot org> <CAMe9rOrMJMvcqaPG0wRyY5O0Q_WC=-DBrZwOJboS_5Otw3Y5GA at mail dot gmail dot com> <20150410145906 dot GO27812 at bubble dot grove dot modra dot org> <CAMe9rOoU=pCmLVL5-snT6LgAXzFL0mBQAxwoSOqENDUyg8jhOA at mail dot gmail dot com> <CAMe9rOpEbuyWBRH1ycjcoSmeEEgcqBZCEsF7HnOS=dLJ6bRm6g at mail dot gmail dot com> <CAMe9rOrmrmQOrYgEGfJVoU8O74X+0KQruOqK98RxbzRbRtwUwA at mail dot gmail dot com> <20150413033246 dot GD15800 at bubble dot grove dot modra dot org> <CAMe9rOrvx9F13aQddq48RpoLV6c3zKJ=fjB6r+n7s=b_dYQcJA at mail dot gmail dot com>
On Mon, Apr 13, 2015 at 04:55:47AM -0700, H.J. Lu wrote:
> On Sun, Apr 12, 2015 at 8:32 PM, Alan Modra <firstname.lastname@example.org> wrote:
> > On Sat, Apr 11, 2015 at 08:27:58AM -0700, H.J. Lu wrote:
> >> On Fri, Apr 10, 2015 at 4:52 PM, H.J. Lu <email@example.com> wrote:
> >> > I will add a linker switch, -z extern-protected-data, to control
> >> > linker behavior.
> >> Here is a patch to add such an option. OK for master?
> > Why is this option needed?
> To work around the GCC bug. Otherwise, we got
> [hjl@gnu-tools-1 pr17709]$ cat bar.c
> int a;
> __attribute__((visibility("protected"))) int a;
> bar ()
> a = 30;
> [hjl@gnu-tools-1 pr17709]$ make libbar.so
> gcc -m32 -fPIC -c -o bar.o bar.c
> ./ld -m elf_i386 -shared -o libbar.so bar.o
> ./ld: bar.o: relocation R_386_GOTOFF against protected data `a' can
> not be used when making a shared object
I presume this isn't gcc-5. So for code generated by older versions
of gcc you now emit an error when linking shared libraries that access
protected visibility variables? And the reason you emit an error when
building the shared library is that you'd like everyone to use gcc-5?
I really dislike the way this whole saga is playing out. Especially
since you know that there is absolutely nothing wrong with using
R_386_GOTOFF against protected visibility data. In fact, code using a
relative access is more efficient, and I wouldn't be surprised if
someone raises a gcc-5 regression over *not* using R_386_GOTOFF in a
shared library making heavy use of protected visibility.
If you want to go ahead with this patch, you need to make it x86
specific. -z extern-protected-data is not appropriate as a general
Australia Development Lab, IBM