.rodata section defined as Writeable as well as Text program header

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

.rodata section defined as Writeable as well as Text program header

Alex Kogan

Hello, all.

Another  animality I see when compiling current (2005-12-27) glibc sources
by gcc 4.1 on RHEL4/PowerPC machine: in libm.so.6 library,  .rodata is
defined as Writeable, and so Text program header does.
Section headers:
  [12] .text             PROGBITS        0000a390 00a390 0361c0 00  AX  0
0 16
  [13] .rela.text        RELA            00000000 082f64 012264 0c     48
12  4
  [14] .fini             PROGBITS        00040550 040550 000038 00  AX  0
0  4
  [15] .rela.fini        RELA            00000000 0951c8 000024 0c     48
14  4
  [16] .rodata           PROGBITS        00040588 040588 037508 00  WA  0
0  8
  [17] .rela.rodata      RELA            00000000 0951ec 000ce4 0c     48
16  4
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x00000034 0x00000034 0x00100 0x00100 R E 0x4
  INTERP         0x077a90 0x00077a90 0x00077a90 0x00024 0x00024 R   0x4
      [Requesting program interpreter: /opt/biarch/20050923/lib/ld.so.1]
  LOAD           0x000000 0x00000000 0x00000000 0x77ab8 0x77ab8 RWE 0x10000
  ...

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_d
.gnu.version_r .rela.dyn .rela.plt .init .text .fini .rodata .interp
.eh_frame
   ...

The configuration I use:
../glibc-2005-12-27/configure --prefix=/opt/biarch/20050923
--build=powerpc-unknwon-linux-gnu
--with-headers=/opt/biarch/20050923/include
--with-binutils=/opt/biarch/20050923/bin --libdir=/opt/biarch/20050923/lib
--enable-add-ons=linuxthreads --enable-add-ons=nptl --with-selinux

Any ideas why it happens?

Thanks in advance,
_______________________________
Alex Kogan
IBM Research Labs

Reply | Threaded
Open this post in threaded view
|

Re: .rodata section defined as Writeable as well as Text program header

Nick Clifton
Hi Alex,

> Another  animality I see when compiling current (2005-12-27) glibc sources
> by gcc 4.1 on RHEL4/PowerPC machine: in libm.so.6 library,  .rodata is
> defined as Writeable, and so Text program header does.

>   [16] .rodata           PROGBITS        00040588 040588 037508 00  WA  0

> Any ideas why it happens?

Output sections inherit the attributes of the input sections that were
mapped onto them.  Therefore the most likely cause is that one or more
input sections with the writable flag (SHF_WRITE) set are being mapped
into the .rodata output section.  Find out which sections these are (eg
using the -Map linker switch) and then fix them.

Cheers
   Nick