PR31941 objcopy --globalize-symbol

Message ID
State New
Series PR31941 objcopy --globalize-symbol |


Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 warning Patch is already merged

Commit Message

Alan Modra July 1, 2024, 1:43 a.m. UTC
  I think FILE symbols are special, and I can't see why anyone would
want them to be made global.  The fact that no one has reported this
bug since commit 7b4a0685e80a in 2005 supports that claim.

	PR 31941
	* objcopy.c (filter_symbols): Don't allow BSF_FILE symbols to
	be made global.


diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index f54ae734198..5fb33b5509a 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1743,6 +1743,7 @@  filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
 	  else if (!undefined
 		   && (flags & BSF_LOCAL)
+		   && !(flags & BSF_FILE)
 		   && is_specified_symbol (name, globalize_specific_htab))
 	      flags &= ~BSF_LOCAL;