On Wed, Oct 21, 2015 at 10:38:10 -0700, H.J. Lu wrote:
> On Wed, Oct 21, 2015 at 10:33 AM, Ilya Verbin <iver...@gmail.com> wrote:
> > H.J.,
> > Maybe linker should print some warning about joining writable + nonwritable
> > sections?  Here is a simple testcase:
> >
> > $ cat t1.s
> > .section ".AAA", "a"
> > .long 0x12345678
> > $ cat t2.s
> > .section ".AAA", "wa"
> > .long 0x12345678
> > $ as t1.s -o t1.o
> > $ as t2.s -o t2.o
> > $ ld -shared t1.o t2.o
> > $ ls -lh a.out
> > 2.1M a.out
> >
> 
> Does linker make AAA  writable? If yes, linker does what it
> is told.

Yes, it makes it writable, but why it also makes this?

  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .hash             HASH             00000000000000b0  000000b0
       0000000000000028  0000000000000004   A       2     0     8
  [ 2] .dynsym           DYNSYM           00000000000000d8  000000d8
       0000000000000078  0000000000000018   A       3     2     8
  [ 3] .dynstr           STRTAB           0000000000000150  00000150
       0000000000000019  0000000000000000   A       0     0     1
  [ 4] .AAA              PROGBITS         0000000000000169  00000169
       0000000000000008  0000000000000000  WA       0     0     1
  [ 5] .eh_frame         PROGBITS         0000000000000178  00000178
       0000000000000000  0000000000000000   A       0     0     8
  [ 6] .dynamic          DYNAMIC          0000000000200178  00200178  <-- ???
       00000000000000b0  0000000000000010  WA       3     0     8
  [ 7] .shstrtab         STRTAB           0000000000000000  00200380
       0000000000000049  0000000000000000           0     0     1
  [ 8] .symtab           SYMTAB           0000000000000000  00200228
       0000000000000120  0000000000000018           9     9     8
  [ 9] .strtab           STRTAB           0000000000000000  00200348
       0000000000000038  0000000000000000           0     0     1

  -- Ilya

Reply via email to