This is the mail archive of the binutils@sourceware.org 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]

New flag --keep-section <section_name> to prevent certain sections from being linker garbage collected.


Hi,

  This patch adds a new flag, --keep-section to allow specifying
section names that should not be gc'ed.

  For use cases, as an example,  a statically linked executable with
pthreads needs .rodata.nptl_version to be debuggable with gdb but
--gc-sections simply discards it. With this option,
--keep-section,.rodata.nptl_version will solve the problem. The
-u,<symbolname> does not work if the symbol is local.


	* options.h (--keep-section): New option.
	* object.cc (Relobj::is_section_name_included): Return true
	if section name matches any section specified with --keep-section.
	* testsuite/Makefile.am (gc_keep_section_test): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/gc_keep_section_test.cc: New file.
	* testsuite/gc_keep_section_test.sh: New file.


Comments?

Thanks,
-Sri.

Attachment: gc_keep_section_patch.txt
Description: Text document


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