This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: binutils/gcc build problem on aarch64 (section size is larger tha


Hi Steve,

>> /home/sellcey/build-gcc/install/bin/ld: error: /usr/lib/gcc/aarch64-
>> linux-gnu/7/../../../aarch64-linux-gnu/crt1.o(.plt) section size
>> (0x7a0 bytes) is larger than file size (0x750 bytes)
 
Sorry about this.  Would you mind trying out the attached patch and
letting me know if it solves the problem for you ?

Cheers
  Nick

PS.  This bug has also been reported as PR 24753...


diff --git a/bfd/compress.c b/bfd/compress.c
index cba281dca4..00ff10df22 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -253,6 +253,10 @@ 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 created by the
+		 linker.  */
+	      && (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.  */
diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
index 4c13f26f4e..93f60a9b61 100644
--- a/ld/emultempl/aarch64elf.em
+++ b/ld/emultempl/aarch64elf.em
@@ -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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]