This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

_GLOBAL_OFFSET_TABLE_ and visibility (with conceptual patch)


Any reason to not set STV_HIDDEN (or perhaps STV_INTERNAL) for
_GLOBAL_OFFSET_TABLE_, besides compatibility with old ld.so:s?
I can't find anything in gABI; just a reference to the psABI for
all things GOT.  The visibility should be set in
_bfd_elf_create_got_section, or else the target has to assume
what to do to tweak the visibility afterwards, alternativelty go
through the motions of creating the GOT symbol by itself.

Here's a conceptual change to let the target decide, with no
change in current behavior.  Untested, not compiled:

	* elf-bfd.h (struct elf_backend_data): New member got_visibility.
	* elflink.c (_bfd_elf_create_got_section): Use bed->got_visibility
	for visibility for _GLOBAL_OFFSET_TABLE_.
	* elfxx-target.h (elf_backend_got_visibility): Default-set to
	STV_DEFAULT.
	(elfNN_bed): Fill in got_visibility with elf_backend_got_visibility.

Index: elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.93
diff -c -p -r1.93 elf-bfd.h
*** elf-bfd.h	4 Feb 2003 12:49:56 -0000	1.93
--- elf-bfd.h	4 Apr 2003 17:02:42 -0000
*************** struct elf_backend_data
*** 862,867 ****
--- 862,871 ----
    bfd_vma got_header_size;
    bfd_vma plt_header_size;
  
+   /* Visibility for _GLOBAL_OFFSET_TABLE_, applicable only if
+      want_got_sym != 0.  */
+   unsigned char got_visibility;
+ 
    /* This is TRUE if the linker should act like collect and gather
       global constructors and destructors by name.  This is TRUE for
       MIPS ELF because the Irix 5 tools can not handle the .init
Index: elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.30
diff -c -p -r1.30 elflink.c
*** elflink.c	24 Feb 2003 04:50:04 -0000	1.30
--- elflink.c	4 Apr 2003 17:02:43 -0000
*************** _bfd_elf_create_got_section (abfd, info)
*** 90,95 ****
--- 90,96 ----
        h = (struct elf_link_hash_entry *) bh;
        h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
        h->type = STT_OBJECT;
+       h->other = bed->got_visibility;
  
        if (info->shared
  	  && ! _bfd_elf_link_record_dynamic_symbol (info, h))
Index: elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.50
diff -c -p -r1.50 elfxx-target.h
*** elfxx-target.h	12 Mar 2003 22:52:12 -0000	1.50
--- elfxx-target.h	4 Apr 2003 17:02:43 -0000
***************
*** 120,125 ****
--- 120,128 ----
  #ifndef elf_backend_want_got_sym
  #define elf_backend_want_got_sym 1
  #endif
+ #ifndef elf_backend_got_visibility
+ #define elf_backend_got_visibility STV_DEFAULT
+ #endif
  #ifndef elf_backend_gc_mark_hook
  #define elf_backend_gc_mark_hook	NULL
  #endif
*************** static const struct elf_backend_data elf
*** 496,501 ****
--- 499,505 ----
    elf_backend_got_symbol_offset,
    elf_backend_got_header_size,
    elf_backend_plt_header_size,
+   elf_backend_got_visibility,
    elf_backend_collect,
    elf_backend_type_change_ok,
    elf_backend_may_use_rel_p,

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]