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]

How to reclaim .rela.dyn entries for symbols that become hidden?


binutils,

I was cleaning up the hppa plabel emit support, and I noticed that I
have a number of extra R_PARISC_NONE relocs in .rela.dyn. I decided that
I might try to reclaim the wasted space.

An example executable might look like this:

Relocation section '.rela.dyn' at offset 0x2fc contains 11 entries:
 Offset     Info    Type            Sym.Value  Sym. Name + Addend
00000000  00000000 R_PARISC_NONE                                00000000
00000000  00000000 R_PARISC_NONE                                00000000
00000000  00000000 R_PARISC_NONE                                00000000
00000000  00000000 R_PARISC_NONE                                00000000
00010420  00000542 R_PARISC_PLABEL21 0001054c   main + 0
00010424  00000546 R_PARISC_PLABEL14 0001054c   main + 0
00010430  00000442 R_PARISC_PLABEL21 000106e0   __libc_csu_init + 0
00010434  00000446 R_PARISC_PLABEL14 000106e0   __libc_csu_init + 0
00010438  00000242 R_PARISC_PLABEL21 00010770   __libc_csu_fini + 0
0001043c  00000246 R_PARISC_PLABEL14 00010770   __libc_csu_fini + 0
000108b4  00000841 R_PARISC_PLABEL32 00000000   _Jv_RegisterClasses + 0

Lets not worry about wether this is optimal (It's not and the fix is to
change glibc/sysdeps/hppa/start.S to use plabel words so these become 1
reloc each).

Symbol table '.dynsym' contains 11 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00020b18     0 OBJECT  LOCAL  HIDDEN  ABS __fini_array_end
     2: 00010770   132 FUNC    GLOBAL DEFAULT   11 __libc_csu_fini
     3: 00020b18     0 OBJECT  LOCAL  HIDDEN  ABS __fini_array_start
     4: 000106e0   144 FUNC    GLOBAL DEFAULT   11 __libc_csu_init
     5: 0001054c    28 FUNC    GLOBAL DEFAULT   11 main
     6: 00020b18     0 OBJECT  LOCAL  HIDDEN  ABS __init_array_end
     7: 00020b18     0 OBJECT  LOCAL  HIDDEN  ABS __init_array_start
     8: 00000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
     9: 00000000   368 FUNC    GLOBAL DEFAULT  UND __libc_start_main@GLIBC_2.2 (2)
    10: 00010884     4 FUNC    WEAK   DEFAULT   11 __gmon_start__

Let us also not worry why --export-dynamic is the default on hppa.
Though I may raise such a discussion later, under the flag of "function
descriptor comparisons."

The four R_PARISC_NONE entries seem to come from somewhere? There are
infact 4 hidden symbols. In check_relocs they are not hidden, but space
is *not* allocated to them. However, allocate_dynrelocs does eventually
see they are dynamic and records that (bfd_elf_link_record_dynamic_symbol).
Does this call have any side effects that I might not realize?
In relocate_section though the visibility is hidden.

Are these hidden symbols the cuprits of the extra relocs in .rela.dyn,
or should I be looking elsewhere?

c.




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