This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
2 problems with ELF visibility
- From: "H . J . Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Mon, 22 Apr 2002 12:06:57 -0700
- Subject: 2 problems with ELF visibility
There are 2 problems with ELF visibility:
1. We don't turn hidden/internal into local unless it is a dynamic symbol.
# cat c.c
extern void *foo __attribute__ ((__visibility__ ("hidden")));
void *foo = 0;
main ()
{
}
# gcc c.c
# readelf -a a.out | grep foo
72: 0804945c 4 OBJECT GLOBAL HIDDEN 15 foo
That is not a big problem since it won't be used by ld.so. But it will be
nice to have it local instead of global.
2. _bfd_elf_link_record_dynamic_symbol in elflink.c doesn't call
elf_backend_hide_symbol. Instead, it sets ELF_LINK_FORCED_LOCAL directly.
It doesn't work with MIPS. I got
mips-linux-gcc -O2 -pipe -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith
-Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -o test1 -static
test1.o ./.libs/libpopt.a
/export/tools/lib/gcc-lib/mips-linux/2.96/../../../../mips-linux/bin/ld: not enough
GOT space for local GOT entries
/export/tools/lib/gcc-lib/mips-linux/2.96/../../../../mips-linux/bin/ld: BFD
2.12.90.0.5 20020421 internal error, aborting at
/home/hjl/work/gnu/src/tools/tools/bfd/elfxx-mips.c line 5276 in
_bfd_mips_elf_relocate_section
You have to use elf_backend_hide_symbol to turn a global symbol into local
on MIPS. How should we fix it?
H.J.