forked from Imagelibrary/binutils-gdb
Improve COFF/PE linker garbage collection by preventing the removal of sections containing exported symbols.
PR ld/19803 * ldlang.c (lang_add_gc_name): New function. Adds the provided symbol name to the list of gc symbols. (lang_process): Call lang_add_gc_name with entry_symbol_default if entry_symbol.name is NULL. Use lang_add_gc_name to add the init and fini function names. * pe-dll.c (process_def_file_and_drectve): Add exported names to the gc symbol list. * testsuite/ld-pe/pr19803.s: Do not export _testval symbol. * testsuite/ld-pe/pr19803.d: Tweak expected output.
This commit is contained in:
@@ -897,6 +897,9 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
|
||||
char *int_name = pe_def_file->exports[i].internal_name;
|
||||
char *name;
|
||||
|
||||
/* PR 19803: Make sure that any exported symbol does not get garbage collected. */
|
||||
lang_add_gc_name (int_name);
|
||||
|
||||
name = xmalloc (strlen (int_name) + 2);
|
||||
if (pe_details->underscored && int_name[0] != '@')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user