This is the mail archive of the
mailing list for the binutils project.
Re: PATCH: Fix visibility for MIPS (Re: 2 problems with ELF visibility)
On Wed, Apr 24, 2002 at 10:57:57AM -0700, H . J . Lu wrote:
> On Wed, Apr 24, 2002 at 11:53:06PM +0930, Alan Modra wrote:
> > On Mon, Apr 22, 2002 at 12:44:47PM -0700, H . J . Lu wrote:
> > > I am enclosing a patch here. Any comments?
> > >
> > > * elfxx-mips.c (mips_elf_link_hash_entry): Add forced_local.
> > > (mips_elf_link_hash_newfunc): Initialize forced_local to false.
> > > (mips_elf_record_global_got_symbol): Call _bfd_mips_elf_hide_symbol
> > > to hide a global symbol.
> > > (_bfd_mips_elf_hide_symbol): Return if forced_local is true. Set
> > > forced_local to true.
> > The idea seems reasonable, but why can't you use ELF_LINK_FORCED_LOCAL
> > instead of using a new flag?
> Here is a patch which does that.
I prefer your first patch. We ought to avoid adding extra back end
hooks where possible. BTW, I wasn't trying to say that using a new
flag was bad in itself, just that it seemed at first glance to be
duplicating an existing flag.
IMHO, the real problem is that mips (and other backends) that allocate
space for dynamic relocs and plt/got entries in check_relocs are
fundamentally broken. It's close to impossible to avoid wasting
space, and hard to even get right when you have to handle symbol
visibility; You need hacks and call-backs to adjust decisions you
made in check_relocs. It's much easier to do correctly if you delay
allocation until size_dynamic_sections, when symbols have stabilized.
IBM OzLabs - Linux Technology Centre