Fix a bug recently introduced to the linker where it would complain about a section...
authorNick Clifton <nickc@redhat.com>
Tue, 2 Jul 2019 13:14:13 +0000 (14:14 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 2 Jul 2019 13:14:13 +0000 (14:14 +0100)
PR 24753
bfd * compress.c (bfd_get_full_section_contents): Do not complain
about linker created sections that are larger than the file size.

ld * emultempl/aarch64elf.em (_aarch64_add_stub_section): Include the
LINKER_CREATED section flag when creating the stub section.

bfd/ChangeLog
bfd/compress.c
ld/ChangeLog
ld/emultempl/aarch64elf.em

index af25e433af55c872ee6d8f5a4b3f4cca927995b6..063af9ca100347d06b57d0e07830a97d2a76251c 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-02  Nick Clifton  <nickc@redhat.com>
+
+       PR 24753
+       * compress.c (bfd_get_full_section_contents): Do not complain
+       about linker created sections that are larger than the file size.
+
 2019-07-02  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * bfd/elf32-arm.c (CMSE_STUB_NAME): New define.
index cba281dca49348ab216f24b5669ec7687133fad6..32de09923df42fa53c400a2da62b5dc527e40019 100644 (file)
@@ -253,6 +253,9 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
          ufile_ptr filesize = bfd_get_file_size (abfd);
          if (filesize > 0
              && filesize < sz
+             /* PR 24753: Linker created sections can be larger than
+                the file size, eg if they are being used to hold stubs.  */
+             && (bfd_get_section_flags (abfd, sec) & SEC_LINKER_CREATED) == 0
              /* The MMO file format supports its own special compression
                 technique, but it uses COMPRESS_SECTION_NONE when loading
                 a section's contents.  */
index 0f0619626d109a220652090d48a71a754f256e3e..d4916f4b698cc6216b1d49ce2e0e74100bfc8c26 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-02  Nick Clifton  <nickc@redhat.com>
+
+       PR 24753
+       * emultempl/aarch64elf.em (_aarch64_add_stub_section): Include the
+       LINKER_CREATED section flag when creating the stub section.
+
 2019-07-02  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
 
        * testsuite/ld-arm/arm-elf.exp: Add tests.
index 4c13f26f4e11a2830e57db9673d29a842a83a2ad..93f60a9b61311fb38f67101dd4787032e2d2ffc9 100644 (file)
@@ -169,7 +169,7 @@ elf${ELFSIZE}_aarch64_add_stub_section (const char *stub_sec_name,
   lang_output_section_statement_type *os;
   struct hook_stub_info info;
 
-  flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
+  flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_LINKER_CREATED
           | SEC_HAS_CONTENTS | SEC_RELOC | SEC_IN_MEMORY | SEC_KEEP);
   stub_sec = bfd_make_section_anyway_with_flags (stub_file->the_bfd,
                                                 stub_sec_name, flags);
This page took 0.027554 seconds and 4 git commands to generate.