diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8bc7ee979d..0712414952 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-04-21 Tamar Christina + + PR binutils/24753 + * compress.c (bfd_get_full_section_contents): Exclude sections with no + content. + 2020-04-21 H.J. Lu PR ld/25849 diff --git a/bfd/compress.c b/bfd/compress.c index ce6bb2beae..728ba39dfb 100644 --- a/bfd/compress.c +++ b/bfd/compress.c @@ -255,6 +255,9 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) /* PR 24753: Linker created sections can be larger than the file size, eg if they are being used to hold stubs. */ && (bfd_section_flags (sec) & SEC_LINKER_CREATED) == 0 + /* PR 24753: Sections which have no content should also be + excluded as they contain no size on disk. */ + && (bfd_section_flags (sec) & SEC_HAS_CONTENTS) != 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/gas/ChangeLog b/gas/ChangeLog index 3185bdcf36..757263330c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2020-04-21 Tamar Christina + + PR binutils/24753 + * testsuite/gas/arm/pr24753.d: New test. + * testsuite/gas/arm/pr24753.s: New test. + 2020-04-21 H.J. Lu PR gas/23840 diff --git a/gas/testsuite/gas/arm/pr24753.d b/gas/testsuite/gas/arm/pr24753.d new file mode 100644 index 0000000000..01990d1ff5 --- /dev/null +++ b/gas/testsuite/gas/arm/pr24753.d @@ -0,0 +1,7 @@ +#skip: *-*-pe *-*-wince *-*-vxworks +#objdump: -d +#name: PR24753: Don't error on sections with no content size mismatch with file + +.*: +file format .*arm.* + +#... diff --git a/gas/testsuite/gas/arm/pr24753.s b/gas/testsuite/gas/arm/pr24753.s new file mode 100644 index 0000000000..5ba33fd29c --- /dev/null +++ b/gas/testsuite/gas/arm/pr24753.s @@ -0,0 +1,12 @@ +.text +.global _start +_start: + nop + +.section .text2, "ax", %progbits +_func: + nop + +.bss +.fill 0x8000 +