aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-09-29 06:33:03 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-09-29 06:33:24 -0700
commitc68c16371639f360d1b110eacf4b1a28ddb5cf53 (patch)
treebf509df0af5ca85cd1b7930fb905b81a0e96949f /ld
parent7ecc513a44095d614f10e89c67d9be5826abacf9 (diff)
downloadgdb-c68c16371639f360d1b110eacf4b1a28ddb5cf53.zip
gdb-c68c16371639f360d1b110eacf4b1a28ddb5cf53.tar.gz
gdb-c68c16371639f360d1b110eacf4b1a28ddb5cf53.tar.bz2
Adjust the output section size to skip gap fills
In objcopy, copy_object calls copy_section to copy contents of input section to output section. When --gap-fill= is used, objcopy extends the size of output sectios to fill gaps between output sections with gap fills. In this case, we adjust the output section size to skip gap files to avoid reading beypond the input section buffer before calling copy_section and restore the output section size after input sections have been copied. binutils/ PR binutils/19005 * objcopy.c (copy_object): Adjust the output section size to skip gap fills between sections when copying from input sections to output sections. ld/testsuite/ PR binutils/19005 * ld-elf/pr19005.d: New file. * ld-elf/pr19005.s: Likewise. * ld-elf/pr19005.t: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-elf/pr19005.d10
-rw-r--r--ld/testsuite/ld-elf/pr19005.s11
-rw-r--r--ld/testsuite/ld-elf/pr19005.t6
4 files changed, 34 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 3a6a509..40eb358 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/19005
+ * ld-elf/pr19005.d: New file.
+ * ld-elf/pr19005.s: Likewise.
+ * ld-elf/pr19005.t: Likewise.
+
2015-08-11 Peter Zotov <whitequark@whitequark.org>
PR ld/18759
diff --git a/ld/testsuite/ld-elf/pr19005.d b/ld/testsuite/ld-elf/pr19005.d
new file mode 100644
index 0000000..a4df0d3
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr19005.d
@@ -0,0 +1,10 @@
+#ld: -Tpr19005.t
+#objcopy_linked_file: -O binary -j .foo -j .bar --gap-fill=0xff
+#objdump: -b binary -s
+
+#...
+Contents of section .data:
+ 0000 10ffffff ffffffff ffffffff ffffffff ................
+ 0010 ffffffff ffffffff ffffffff ffffffff ................
+ 0020 20.*
+#pass
diff --git a/ld/testsuite/ld-elf/pr19005.s b/ld/testsuite/ld-elf/pr19005.s
new file mode 100644
index 0000000..8bd860f
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr19005.s
@@ -0,0 +1,11 @@
+ .section .foo,"ax",%progbits
+ .globl _start
+ .type _start, %function
+_start:
+ .byte 0x10
+ .section .bar,"ax",%progbits
+ .globl aligned
+ .type aligned, %function
+ .p2align 5
+aligned:
+ .byte 0x20
diff --git a/ld/testsuite/ld-elf/pr19005.t b/ld/testsuite/ld-elf/pr19005.t
new file mode 100644
index 0000000..0e89e0b
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr19005.t
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ .foo : { *(.foo) }
+ .bar : { *(.bar) }
+ /DISCARD/ : { *(.*) }
+}