public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [need your help] about the linker script "x86_64-linux-gnu / ldscripts / elf_x86_64.xce"
@ 2023-07-02  2:22 zhtuan
  0 siblings, 0 replies; only message in thread
From: zhtuan @ 2023-07-02  2:22 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]

hi,


I am using ldscripts / elf_x86_64.xce for linking one c++ program, and need to mlock the rodata during software startup phase(make sure there is no min pagefault during accessing the many large static const array), how can we get the address of that rodata(seem we could get the __executable_start/__bss_start by default)? could we add   PROVIDE (__rodata_start = .) and PROVIDE (__rodata_end = .) for those rodata part in elf_x86_64.xce? is there other solution? thanks in advance.


...
  PROVIDE (__etext = .);
  PROVIDE (_etext = .);
  PROVIDE (etext = .);
  . = ALIGN(CONSTANT (MAXPAGESIZE));
  /* Adjust the address for the rodata segment.  We want to adjust up to
     the same address within the page on the next page up.  */
  . = SEGMENT_START("rodata-segment", ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)));
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  .rodata1        : { *(.rodata1) }
  .eh_frame_hdr   : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
  .gnu_extab   : ONLY_IF_RO { *(.gnu_extab*) }
  /* These sections are generated by the Sun/Oracle C++ compiler.  */
  .exception_ranges   : ONLY_IF_RO { *(.exception_ranges*) }
  /* Adjust the address for the data segment.  We want to adjust up to
     the same address within the page on the next page up.  */


Regards
zhang huituan

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-02  2:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-02  2:22 [need your help] about the linker script "x86_64-linux-gnu / ldscripts / elf_x86_64.xce" zhtuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).