som foreign syms
Alan Modra
amodra@gmail.com
Fri Nov 21 23:31:45 GMT 2025
The makes use of the copy_private_symbol_data change in order to
prevent bogus writes seen when running objcopy with binary input and
som output. It doesn't fix "FAIL: binary symbol", because the som
backend also doesn't copy binary sections to the output, a fact that I
didn't notice until I'd gone quite some way into fixing symbols..
* som.c (som_bfd_copy_private_symbol_data): Make som symbols
for non-som input.
diff --git a/bfd/som.c b/bfd/som.c
index adc9c55bd17..105800bc8fc 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -4351,7 +4351,9 @@ som_bfd_derive_misc_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
The behavior of these flags is not well documentmented, so there
may be bugs and some surprising interactions with other flags. */
- if (som_section_data (sym->section)
+ if (sym->section->owner != NULL
+ && sym->section->owner->xvec->flavour == bfd_target_som_flavour
+ && som_section_data (sym->section)
&& som_section_data (sym->section)->subspace_dict
&& info->symbol_scope == SS_UNIVERSAL
&& (info->symbol_type == ST_ENTRY
@@ -5349,9 +5351,17 @@ som_bfd_copy_private_symbol_data (bfd *ibfd,
bfd *obfd ATTRIBUTE_UNUSED,
asymbol **osymbol)
{
- /* One day we may try to grok other private data. */
if (ibfd->xvec->flavour != bfd_target_som_flavour)
- return false;
+ {
+ /* The som backend makes use of som specific symbol fields
+ when outputting symbols. */
+ asymbol *osym = som_make_empty_symbol (obfd);
+ if (osym == NULL)
+ return false;
+ memcpy (osym, *isymbol, sizeof (*osym));
+ osym->the_bfd = obfd;
+ return true;
+ }
/* The only private information we need to copy is the argument relocation
bits. */
--
Alan Modra
More information about the Binutils
mailing list