Downgrade linker error on protected symbols in .dynbss to a warning
H.J. Lu
hjl.tools@gmail.com
Mon Apr 13 11:55:00 GMT 2015
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.
More information about the Binutils
mailing list