diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-11-29 05:55:23 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-11-29 05:55:35 -0800 |
commit | 8ca751ee637ce1b8d1b284a794ffdb327951d0f8 (patch) | |
tree | ad55a7b80f214c2b63cf2059f5740eb94e9902e1 /gold/object.cc | |
parent | b214250c1e058b251ec90f024795965ad1f9e91d (diff) | |
download | fsf-binutils-gdb-8ca751ee637ce1b8d1b284a794ffdb327951d0f8.zip fsf-binutils-gdb-8ca751ee637ce1b8d1b284a794ffdb327951d0f8.tar.gz fsf-binutils-gdb-8ca751ee637ce1b8d1b284a794ffdb327951d0f8.tar.bz2 |
gold: Get linkonce/comdate sections for debugging sections
When relocating debug sections, get the section index for the linkonce
section. Since symbols referenced in debugging sections can be defined
a single comdat section with a different section name, also check the
single comdat section.
PR gold/26937
* object.cc (Sized_relobj_file::map_to_kept_section): Get the
section index for linkonce section. Also check the single
comdat section.
* testsuite/Makefile.am (check_SCRIPTS): Add pr26936.sh.
(check_DATA): Add pr26936a.stdout and pr26936b.stdout.
(MOSTLYCLEANFILES): Add pr26936a and pr26936b.
(pr26936a.stdout): New target.
(pr26936a): Likewise.
(pr26936b.stdout): Likewise.
(pr26936b): Likewise.
(pr26936a.o): Likewise.
(pr26936b.o): Likewise.
(pr26936c.o): Likewise.
(pr26936d.o): Likewise.
* testsuite/Makefile.in: Regenerated.
* testsuite/pr26936.sh: New file.
* testsuite/pr26936a.s: Likewise.
* testsuite/pr26936b.s: Likewise.
* testsuite/pr26936c.s: Likewise.
* testsuite/pr26936d.s: Likewise.
Diffstat (limited to 'gold/object.cc')
-rw-r--r-- | gold/object.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gold/object.cc b/gold/object.cc index c486a20..c0d0f02 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -2981,17 +2981,20 @@ Sized_relobj_file<size, big_endian>::map_to_kept_section( { // The kept section is a linkonce section. if (sh_size == kept_section->linkonce_size()) - found = true; + { + kept_shndx = kept_section->shndx(); + found = true; + } } else { + uint64_t kept_size = 0; if (is_comdat) { // Find the corresponding kept section. // Since we're using this mapping for relocation processing, // we don't want to match sections unless they have the same // size. - uint64_t kept_size = 0; if (kept_section->find_comdat_section(section_name, &kept_shndx, &kept_size)) { @@ -2999,9 +3002,8 @@ Sized_relobj_file<size, big_endian>::map_to_kept_section( found = true; } } - else + if (!found) { - uint64_t kept_size = 0; if (kept_section->find_single_comdat_section(&kept_shndx, &kept_size) && sh_size == kept_size) |