V2 [PATCH] elf: Get the real kept section
H.J. Lu
hjl.tools@gmail.com
Wed Nov 25 13:56:34 GMT 2020
More information about the Binutils mailing list
Wed Nov 25 13:56:34 GMT 2020
- Previous message (by thread): [PATCH] elf: Get the real kept section
- Next message (by thread): V2 [PATCH] elf: Get the real kept section
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Nov 25, 2020 at 5:15 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > When mixing linkonce and comdat sections, we need to keep searching to > get the real kept section. > > bfd/ > > PR ld/26936 > * elflink.c (_bfd_elf_check_kept_section): Get the real kept > section. > > ld/ > > PR ld/26936 > * testsuite/ld-elf/pr26936.d: New file. > * testsuite/ld-elf/pr26936a.s: Likewise. > * testsuite/ld-elf/pr26936b.s: Likewise. > * testsuite/ld-elf/pr26936c.s: Likewise. > --- > bfd/elflink.c | 9 +++++++++ > ld/testsuite/ld-elf/pr26936.d | 12 ++++++++++++ > ld/testsuite/ld-elf/pr26936a.s | 6 ++++++ > ld/testsuite/ld-elf/pr26936b.s | 11 +++++++++++ > ld/testsuite/ld-elf/pr26936c.s | 6 ++++++ > 5 files changed, 44 insertions(+) > create mode 100644 ld/testsuite/ld-elf/pr26936.d > create mode 100644 ld/testsuite/ld-elf/pr26936a.s > create mode 100644 ld/testsuite/ld-elf/pr26936b.s > create mode 100644 ld/testsuite/ld-elf/pr26936c.s > > diff --git a/bfd/elflink.c b/bfd/elflink.c > index 7ba667a824..94ed560e04 100644 > --- a/bfd/elflink.c > +++ b/bfd/elflink.c > @@ -10702,6 +10702,15 @@ _bfd_elf_check_kept_section (asection *sec, struct bfd_link_info *info) > && ((sec->rawsize != 0 ? sec->rawsize : sec->size) > != (kept->rawsize != 0 ? kept->rawsize : kept->size))) > kept = NULL; > + else > + { > + /* Get the real kept section. */ > + asection *next; > + for (next = kept->kept_section; > + next != NULL; > + next = next->kept_section) > + kept = next; > + } > sec->kept_section = kept; > } > return kept; Here is the updated patch to check kept != NULL. -- H.J. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-elf-Get-the-real-kept-section.patch Type: application/x-patch Size: 3768 bytes Desc: not available URL: <https://sourceware.org/pipermail/binutils/attachments/20201125/34755495/attachment.bin>
- Previous message (by thread): [PATCH] elf: Get the real kept section
- Next message (by thread): V2 [PATCH] elf: Get the real kept section
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list