.{init,fini,preinit}_array in RW segment??

Jakub Jelinek jakub@redhat.com
Mon Jan 13 13:17:00 GMT 2003


Hi!

In the builtin linker script, these sections are located in RW segment
even for binaries.
...
  /* Adjust the address for the data segment.  We want to adjust up to
     the same address within the page on the next page up.  */
  ${CREATE_SHLIB-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}

  /* Ensure the __preinit_array_start label is properly aligned.  We
     could instead move the label definition inside the section, but
     the linker would then create the section even if it turns out to
     be empty, which isn't pretty.  */
  ${RELOCATING+. = ALIGN(${ALIGNMENT});}
  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}}
  .preinit_array   ${RELOCATING-0} : { *(.preinit_array) }
  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}}

  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}}
  .init_array   ${RELOCATING-0} : { *(.init_array) }
  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}}

  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}}
  .fini_array   ${RELOCATING-0} : { *(.fini_array) }
  ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}}
...

Shouldn't they be in the RO segment for binaries?

	Jakub



More information about the Binutils mailing list