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: Strange LMA/VMA behavior with regions


Hi,

I tried to figure out why LD produced this gap.

If I change the LD behavior like this

Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.348
diff -u -r1.348 ldlang.c
--- ld/ldlang.c 21 Nov 2010 20:36:24 -0000      1.348
+++ ld/ldlang.c 30 Nov 2010 14:46:50 -0000
@@ -4919,6 +4919,7 @@
                  {
                    bfd_vma savedot = newdot;
                    newdot = align_power (newdot, align);
+                   os->region->current = newdot;

                    if (newdot != savedot
                        && (config.warn_section_align

the problem disappears.  The section begin alignment consumes now also space in
the run-time region.  In case the run-time and load-time regions are equal this
will prevent the artificial offsets.  Please note that the test case "TLS
-fno-pic -shared" in "ld/testsuite/ld-i386/i386.exp" fails now.

Readelf dump without patch:
Section Headers:
  [Nr] Name      Type     Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]           NULL     00000000 000000 000000 00      0   0  0
  [ 1] .hash     HASH     000000b4 0000b4 00003c 04   A  2   0  4
  [ 2] .dynsym   DYNSYM   000000f0 0000f0 0000a0 10   A  3   1  4
  [ 3] .dynstr   STRTAB   00000190 000190 000031 00   A  0   0  1
  [ 4] .rel.dyn  REL      000001c4 0001c4 0000a0 08   A  2   0  4
  [ 5] .text     PROGBITS 00001000 001000 0000f4 00  AX  0   0 4096
  [ 6] .tbss     NOBITS   000020f4 0010f4 000024 00 WAT  0   0  1
  [ 7] .dynamic  DYNAMIC  000020f4 0010f4 000080 08  WA  3   0  4
  [ 8] .got      PROGBITS 00002174 001174 000018 04  WA  0   0  4
  [ 9] .got.plt  PROGBITS 0000218c 00118c 00000c 04  WA  0   0  4
  [10] .shstrtab STRTAB   00000000 001198 00005d 00      0   0  1
  [11] .symtab   SYMTAB   00000000 001400 0001e0 10     12  21  4
  [12] .strtab   STRTAB   00000000 0015e0 000074 00      0   0  1

Readelf dump with patch:
Section Headers:
  [Nr] Name      Type     Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]           NULL     00000000 000000 000000 00      0   0  0
  [ 1] .hash     HASH     000000b4 0000b4 00003c 04   A  2   0  4
  [ 2] .dynsym   DYNSYM   000000f0 0000f0 0000a0 10   A  3   1  4
  [ 3] .dynstr   STRTAB   00000190 000190 000031 00   A  0   0  1
  [ 4] .rel.dyn  REL      000001c4 0001c4 0000a0 08   A  2   0  4
  [ 5] .text     PROGBITS 00001000 001000 0000f4 00  AX  0   0 4096
  [ 6] .tbss     NOBITS   00002000 002000 000024 00 WAT  0   0  1
  [ 7] .dynamic  DYNAMIC  00002000 002000 000080 08  WA  3   0  4
  [ 8] .got      PROGBITS 00002080 002080 000018 04  WA  0   0  4
  [ 9] .got.plt  PROGBITS 00002098 002098 00000c 04  WA  0   0  4
  [10] .shstrtab STRTAB   00000000 0020a4 00005d 00      0   0  1
  [11] .symtab   SYMTAB   00000000 00230c 0001e0 10     12  21  4
  [12] .strtab   STRTAB   00000000 0024ec 000074 00      0   0  1

Is this a problem?  It would be nice if we can use this patch, because this
simplifies linker command files for embedded devices with a scattered memory
map considerable.

Have a nice day!

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


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