This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[RFC] Providing init_fini_syms earlier?
- From: Carlos O'Donell <carlos at systemhalted dot org>
- To: binutils at sources dot redhat dot com
- Date: Tue, 5 Jul 2005 10:13:43 -0400
- Subject: [RFC] Providing init_fini_syms earlier?
binutils,
If I provide the __init_array_start, __init_array_end,
__fini_array_start and __fini_array_end symbols earlier, in particular
before sizing of the dynamic sections, the code has a chance at removing
a possibly hidden local symbol.
A quick test with the following patch is successfull at removing the
extra R_PARISC_NONE relocs which are allocated to these symbosls but
never used. They are allocated because the provides comes after the
sizing and the symbol is assumed to be undefined dynamic. Once the
sizing is done the symbol is added and it's too late to remove those
entries.
I don't believe this patch is correct, a gut feeling says these
symbols should be provided at the last possible instance.
Comments and insight appreciated?
This patch *does* fix the linker, and R_PARISC_NONE extra relocs are no
longer emitted. I don't suggest applying this patch, it's just to start
a discussion.
Cheers,
Carlos.
2005-07-05 Carlos O'Donell <carlos@systemhalted.org>
ld/
* emultempl/elf32.em
(gld${EMULATION_NAME}_finish): Move provides for init fini syms...
(gld${EMULATION_NAME}_before_allocation): ... here.
--- elf32.em 2005-07-05 08:50:36.000000000 -0400
+++ elf32.em.new 2005-07-05 08:50:08.000000000 -0400
@@ -1058,6 +1058,9 @@
referred to by dynamic objects. */
lang_for_each_statement (gld${EMULATION_NAME}_find_statement_assignment);
+ /* Provide all the required symbols to do sizing */
+ gld${EMULATION_NAME}_provide_init_fini_syms ();
+
/* Let the ELF backend work out the sizes of any sections required
by dynamic linking. */
rpath = command_line.rpath;
@@ -1543,7 +1546,8 @@
gld${EMULATION_NAME}_layout_sections_again ();
gld${EMULATION_NAME}_strip_empty_sections ();
- gld${EMULATION_NAME}_provide_init_fini_syms ();
+ /* Provided earlier before resizing */
+ /* gld${EMULATION_NAME}_provide_init_fini_syms (); */
}
EOF
fi