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]

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


In message <200403180034.37251.ebotcazou@act-europe.fr>, Eric Botcazou writes:
 >
 >--------------Boundary-00=_D3VQAEOHCXF5QZ6AE3R4
 >Content-Type: text/plain;
 >  charset="iso-8859-1"
 >Content-Transfer-Encoding: 8bit
 >
 >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 LD
 >SA
 >	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.*.
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
relocations.

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

jeff


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