This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: How to reclaim .rela.dyn entries for symbols that become hidden?
- From: Carlos O'Donell <carlos at systemhalted dot org>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: binutils at sources dot redhat dot com, Randolph Chung <tausq at debian dot org>,John David Anglin <dave dot anglin at nrc-cnrc dot gc dot ca>
- Date: Thu, 30 Jun 2005 16:28:55 -0400
- Subject: Re: How to reclaim .rela.dyn entries for symbols that become hidden?
- References: <20050630165918.GG5269@systemhalted.org> <20050630173057.GB16536@nevyn.them.org>
On Thu, Jun 30, 2005 at 01:30:57PM -0400, Daniel Jacobowitz wrote:
> On Thu, Jun 30, 2005 at 12:59:22PM -0400, Carlos O'Donell wrote:
> > 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.
>
> No, it shouldn't have extra side effects.
Okay.
> > Are these hidden symbols the cuprits of the extra relocs in .rela.dyn,
> > or should I be looking elsewhere?
>
> Somewere, you're allocating the space for them. Probably this means
> that you're counting things incorrectly, or too early. Is
> allocate_dynrelocs allocating space for them despite the fact that they
> are hidden? If not, where's it come from.
I guess I have to go really slowly in the debugger and watch the count.
I wish I knew where I was allocating space for them.
In check_relocs we do some early allocation:
1591: (elf32_hppa_check_relocs): sym main needs a reloc section.
1612: (elf32_hppa_check_relocs): Allocate reloc section .rela.text
1659: (elf32_hppa_check_relocs): Space allocated.
1591: (elf32_hppa_check_relocs): sym __libc_csu_init needs a reloc section.
1659: (elf32_hppa_check_relocs): Space allocated.
1591: (elf32_hppa_check_relocs): sym __libc_csu_fini needs a reloc section.
1659: (elf32_hppa_check_relocs): Space allocated.
1591: (elf32_hppa_check_relocs): sym $global$ needs a reloc section.
1659: (elf32_hppa_check_relocs): Space allocated.
1591: (elf32_hppa_check_relocs): sym _Jv_RegisterClasses needs a reloc section.
1612: (elf32_hppa_check_relocs): Allocate reloc section .rela.rodata.cst4
1659: (elf32_hppa_check_relocs): Space allocated.
'$global$' is allocated, but killed later.
Then in allocate_dynrelocs:
2184: (allocate_dynrelocs): Record dynamic symbol __fini_array_end
2215: (allocate_dynrelocs): dyn_relocs == NULL, sym __fini_array_end
2284: (allocate_dynrelocs): Keep sym __libc_csu_fini
2301: (allocate_dynrelocs): sym __libc_csu_fini, allocated reloc in .rela.text
2290: (allocate_dynrelocs): Kill sym $global$
2184: (allocate_dynrelocs): Record dynamic symbol __fini_array_start
2215: (allocate_dynrelocs): dyn_relocs == NULL, sym __fini_array_start
2284: (allocate_dynrelocs): Keep sym __libc_csu_init
2301: (allocate_dynrelocs): sym __libc_csu_init, allocated reloc in .rela.text
2284: (allocate_dynrelocs): Keep sym main
2301: (allocate_dynrelocs): sym main, allocated reloc in .rela.text
2184: (allocate_dynrelocs): Record dynamic symbol __init_array_end
2215: (allocate_dynrelocs): dyn_relocs == NULL, sym __init_array_end
2184: (allocate_dynrelocs): Record dynamic symbol _GLOBAL_OFFSET_TABLE_
2215: (allocate_dynrelocs): dyn_relocs == NULL, sym _GLOBAL_OFFSET_TABLE_
2184: (allocate_dynrelocs): Record dynamic symbol __init_array_start
2215: (allocate_dynrelocs): dyn_relocs == NULL, sym __init_array_start
2284: (allocate_dynrelocs): Keep sym _Jv_RegisterClasses
2301: (allocate_dynrelocs): sym _Jv_RegisterClasses, allocated reloc in .rela.rodata.cst4
The hidden symbols are recorded but not allocated space for a reloc.
Time to dig more. Perhaps I've missed an allocation somewhere.
The reason I figure it's these symbols is because in the past we had:
Relocation section '.rela.dyn' at offset 0x328 contains 5 entries:
Offset Info Type Sym.Value Sym. Name + Addend
00020a94 00000101 R_PARISC_DIR32 00020940 __fini_array_end + 0
00020a98 00000301 R_PARISC_DIR32 00020940 __fini_array_start + 0
00020a9c 00000601 R_PARISC_DIR32 00020940 __init_array_end + 0
00020aa0 00000701 R_PARISC_DIR32 00020a80 _GLOBAL_OFFSET_TABLE_ + 0
00020aa4 00000801 R_PARISC_DIR32 00020940 __init_array_start + 0
Now they are all hidden or removed (_GOT_).
c.