PATCH: Adjust segment memory size for the SHT_NOBITS section
H. J. Lu
hjl@lucon.org
Wed Mar 7 03:48:00 GMT 2007
On Fri, Mar 02, 2007 at 11:38:18PM +1030, Alan Modra wrote:
> On Fri, Mar 02, 2007 at 01:32:12PM +1030, Alan Modra wrote:
> > Then of course you'd have to wonder why the code wasn't written that
> > way in the first place. Please do some digging to find out why.
>
> I got curious and had a look myself. It looks like my patch
> http://sources.redhat.com/ml/binutils/2004-09/msg00225.html is at
> fault here. Previously, both SEC_LOAD and !SEC_LOAD sections
> adjusted p_memsz based on their lmas. Following that adjustment,
> there was another based on vma.
>
I will check in this testcase shortly.
H.J.
----
2007-03-06 H.J. Lu <hongjiu.lu@intel.com>
PR ld/4144
* ld-elf/nobits-1.d: New file.
* ld-elf/nobits-1.s: Likewise.
* ld-elf/nobits-1.t: Likewise.
--- ld/testsuite/ld-elf/nobits-1.d.nobits 2007-03-06 19:32:14.000000000 -0800
+++ ld/testsuite/ld-elf/nobits-1.d 2007-03-06 19:31:51.000000000 -0800
@@ -0,0 +1,7 @@
+#ld: -Tnobits-1.t
+#readelf: -l --wide
+
+#...
+ Section to Segment mapping:
+ Segment Sections...
+ 00 .foo .bar
--- ld/testsuite/ld-elf/nobits-1.s.nobits 2007-03-06 19:32:20.000000000 -0800
+++ ld/testsuite/ld-elf/nobits-1.s 2007-03-06 18:58:03.000000000 -0800
@@ -0,0 +1,6 @@
+ .globl _entry
+ .section .foo,"awx",%progbits
+_entry:
+ .byte 0
+ .section .bar,"ax",%nobits
+ .byte 0
--- ld/testsuite/ld-elf/nobits-1.t.nobits 2007-03-06 19:32:17.000000000 -0800
+++ ld/testsuite/ld-elf/nobits-1.t 2007-03-06 18:59:02.000000000 -0800
@@ -0,0 +1,13 @@
+ENTRY(_entry)
+PHDRS
+{
+ data PT_LOAD;
+}
+SECTIONS
+{
+ . = 0x1000000;
+ .foo : { *(.foo) } :data
+ . = 0x2000000;
+ .bar : { *(.bar) } :data
+ /DISCARD/ : { *(*) }
+}
More information about the Binutils
mailing list