[PATCH] More aggressive --gc-sections
Eric Botcazou
ebotcazou@act-europe.fr
Wed Mar 17 23:37:00 GMT 2004
Hi,
This is the minimal set of patches needed in order to make --gc-sections
works for dynamically linked Ada programs using DWARF-2 EH on x86/Linux.
For a description of the mechanism, see:
http://gcc.gnu.org/ml/gcc/2004-03/msg00506.html
The GCC part was bootstrapped/regtested on mainline, the binutils part was
tested on mainline, with no new regressions. I ran the ACATS and libstdc++
testsuites with -function-sections -fdata-sections -Wl,--gc-sections too.
I don't expect these patches to be accepted, rather to serve as a starting
point for the discussion. What do you think about the approach? What
criteria should the patches meet to be accepted both in GCC and binutils?
Thanks in advance.
GCC:
* except.h (output_function_exception_table): New prototype.
* output.h (default_exception_section): New prototype.
* target.h (struct gcc_target) <exception_section>: New prototype.
* except.c (PTR_SIZE): New macro.
(default_exception_section): New prototype.
If named sections are supported and flag_function_sections is set,
use a function-specific section.
(output_function_exception_table): New prototype.
Adjust call to targetm.asm_out.exception_section. Keep track of the LDSA
label. If flag_function_sections is set, emit a reference to the LDSA
label in the function section.
* passes.c (rest_of_handle_final): Adjust calls to
output_function_exception_table.
* Makefile.in (LIBGCC2_CFLAGS): Add -ffunction-sections -fdata-sections.
* ada/Makefile.in (GNATLIBCFLAGS): Likewise.
* ada/Make-lang.in (GNATLIBCFLAGS): Likewise.
BFD:
* elflink.h (elf_gc_mark_dynamic_ref_symbol): New function.
(elf_gc_sections): Do not gracefully fail if dynamic sections have
been created. Instead call elf_gc_mark_dynamic_ref_symbol to
mark dynamically referenced symbols. Do not mark the whole graph
rooted at .eh_frame, only the section proper.
LD:
* scripttempl/elf.sc (.text): Add KEEP for .text.*personality*.
(.data): Add KEEP for .gnu.linkonce.d.*personality*.
(.gcc_except_table): Add KEEP for self and accept .gcc_except_table.*.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: split_eh_sections-3.diff
Type: text/x-diff
Size: 7968 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20040317/3ab2b642/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elf_eh_opt.diff
Type: text/x-diff
Size: 3932 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20040317/3ab2b642/attachment-0001.bin>
More information about the Binutils
mailing list