This is the mail archive of the mailing list for the GCC 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]

Re: [PATCH] More aggressive --gc-sections

In message <>, Eric Botcazou writes:
 >Content-Type: text/plain;
 >  charset="iso-8859-1"
 >Content-Transfer-Encoding: 8bit
 >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:
 >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.
 >	* 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 LD
 >	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.
 >	* (LIBGCC2_CFLAGS): Add -ffunction-sections -fdata-sections
 >	* ada/ (GNATLIBCFLAGS): Likewise.
 >	* ada/ (GNATLIBCFLAGS): Likewise.
 >	* 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.
 >	* scripttempl/ (.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.*.
If you wanted to improve the long term maintainability of this code as
well as its compatibility with non-GC'd code you could put the special
GC related relocations into their own special section from the main

That's something Richard and I have talked about for a long long time, but
never got around to doing...


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