From: Alan Modra Date: Fri, 21 Nov 2025 22:45:00 +0000 (+1030) Subject: som foreign syms X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1529b30114989e324f9e555db9f994885c434e50;p=thirdparty%2Fbinutils-gdb.git som foreign syms 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. */