This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Downgrade linker error on protected symbols in .dynbss to a warning
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>, Richard Henderson <rth at redhat dot com>
- Date: Mon, 13 Apr 2015 04:55:47 -0700
- Subject: Re: Downgrade linker error on protected symbols in .dynbss to a warning
- Authentication-results: sourceware.org; auth=none
- References: <20150410094542 dot GL27812 at bubble dot grove dot modra dot org> <CAMe9rOq5nPMRZTm02feeWF1FY8FR7u1T5JGGzChzNM0mH-VHmQ at mail dot gmail dot com> <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>
On Sun, Apr 12, 2015 at 8:32 PM, Alan Modra <amodra@gmail.com> 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 <hjl.tools@gmail.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;
void
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
./ld: final link failed: Bad value
Makefile:20: recipe for target 'libbar.so' failed
make: *** [libbar.so] Error 1
[hjl@gnu-tools-1 pr17709]$
--
H.J.