diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-15 09:42:44 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-15 14:16:02 +0930 |
commit | 4d1823674eedf267c7cafac2b923256db0b10ac8 (patch) | |
tree | f9c342023c7521c374baebe719774048d95a2895 /bfd/ecoff.c | |
parent | a9ca57d09a0b7bffb583e42b8b49541727ce676b (diff) | |
download | gdb-4d1823674eedf267c7cafac2b923256db0b10ac8.zip gdb-4d1823674eedf267c7cafac2b923256db0b10ac8.tar.gz gdb-4d1823674eedf267c7cafac2b923256db0b10ac8.tar.bz2 |
PR26389, nm prints "c" for a common symbol with -flto and -fcommon
git commit 49d9fd42acef chose to make nm print 'C' for the normal
common section, and 'c' for other commons. This was an attempt to
make common symbols in .scommon and other small common sections show
a 'c' type without a section name comparison, but it failed for
nm --plugin on lto objects where normal common symbols are stashed in
a "plug" section. It's also wrong for large common symbols. So
instead set SEC_SMALL_DATA on sections created for small commons, and
key off that flag to show 'c' type. If your ELF target doesn't have
an elf_backend_symbol_processing function, then you won't see 'c' for
symbols in .scommon.
Note that due to bfd_decode_symclass decoding common symbols without
a chance for coff_section_type to treat .scommon specially, then
having .scommon in the array of special sections handled by
coff_section_type prior to 49d9fd42acef was entirely ineffective.
That fact escaped me when writing 49d9fd42acef. Unless .scommon
didn't have SEC_IS_COMMON set, which would be a little weird.
PR 26389
* syms.c (bfd_decode_symclass): Choose 'c' for commons only when
SEC_SMALL_DATA.
* elf32-m32r.c (_bfd_m32r_elf_symbol_processing): Set SEC_SMALL_DATA
on small common section.
* elf32-score.c (s3_bfd_score_elf_symbol_processing): Likewise.
* elf32-score7.c (s7_bfd_score_elf_symbol_processing): Likewise.
* elf32-tic6x.c (elf32_tic6x_symbol_processing): Likewise.
* elf32-v850.c (v850_elf_symbol_processing): Likewise.
* elfxx-mips.c (_bfd_mips_elf_symbol_processing): Likewise.
* ecoff.c (ecoff_set_symbol_info, ecoff_link_add_externals): Likewise.
Diffstat (limited to 'bfd/ecoff.c')
-rw-r--r-- | bfd/ecoff.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/ecoff.c b/bfd/ecoff.c index dcded6f..2e4bf88 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -791,7 +791,7 @@ ecoff_set_symbol_info (bfd *abfd, { /* Initialize the small common section. */ ecoff_scom_section.name = SCOMMON; - ecoff_scom_section.flags = SEC_IS_COMMON; + ecoff_scom_section.flags = SEC_IS_COMMON | SEC_SMALL_DATA; ecoff_scom_section.output_section = &ecoff_scom_section; ecoff_scom_section.symbol = &ecoff_scom_symbol; ecoff_scom_section.symbol_ptr_ptr = &ecoff_scom_symbol_ptr; @@ -3404,7 +3404,7 @@ ecoff_link_add_externals (bfd *abfd, { /* Initialize the small common section. */ ecoff_scom_section.name = SCOMMON; - ecoff_scom_section.flags = SEC_IS_COMMON; + ecoff_scom_section.flags = SEC_IS_COMMON | SEC_SMALL_DATA; ecoff_scom_section.output_section = &ecoff_scom_section; ecoff_scom_section.symbol = &ecoff_scom_symbol; ecoff_scom_section.symbol_ptr_ptr = &ecoff_scom_symbol_ptr; |