vdso-layout.lds.S 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Linker script for vDSO. This is an ELF shared object prelinked to
  3. * its virtual address, and with only one read-only segment.
  4. * This script controls its layout.
  5. */
  6. #if defined(BUILD_VDSO64)
  7. # define SHDR_SIZE 64
  8. #elif defined(BUILD_VDSO32)
  9. # define SHDR_SIZE 40
  10. #else
  11. # error unknown VDSO target
  12. #endif
  13. #define NUM_FAKE_SHDRS 7
  14. SECTIONS
  15. {
  16. /*
  17. * User/kernel shared data is before the vDSO. This may be a little
  18. * uglier than putting it after the vDSO, but it avoids issues with
  19. * non-allocatable things that dangle past the end of the PT_LOAD
  20. * segment. Page size is 8192 for both 64-bit and 32-bit vdso binaries
  21. */
  22. vvar_start = . -8192;
  23. vvar_data = vvar_start;
  24. . = SIZEOF_HEADERS;
  25. .hash : { *(.hash) } :text
  26. .gnu.hash : { *(.gnu.hash) }
  27. .dynsym : { *(.dynsym) }
  28. .dynstr : { *(.dynstr) }
  29. .gnu.version : { *(.gnu.version) }
  30. .gnu.version_d : { *(.gnu.version_d) }
  31. .gnu.version_r : { *(.gnu.version_r) }
  32. .dynamic : { *(.dynamic) } :text :dynamic
  33. .rodata : {
  34. *(.rodata*)
  35. *(.data*)
  36. *(.sdata*)
  37. *(.got.plt) *(.got)
  38. *(.gnu.linkonce.d.*)
  39. *(.bss*)
  40. *(.dynbss*)
  41. *(.gnu.linkonce.b.*)
  42. /*
  43. * Ideally this would live in a C file: kept in here for
  44. * compatibility with x86-64.
  45. */
  46. VDSO_FAKE_SECTION_TABLE_START = .;
  47. . = . + NUM_FAKE_SHDRS * SHDR_SIZE;
  48. VDSO_FAKE_SECTION_TABLE_END = .;
  49. } :text
  50. .fake_shstrtab : { *(.fake_shstrtab) } :text
  51. .note : { *(.note.*) } :text :note
  52. .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
  53. .eh_frame : { KEEP (*(.eh_frame)) } :text
  54. /*
  55. * Text is well-separated from actual data: there's plenty of
  56. * stuff that isn't used at runtime in between.
  57. */
  58. .text : { *(.text*) } :text =0x90909090,
  59. .vread_tick_patch : {
  60. vread_tick_patch_start = .;
  61. *(.vread_tick_patch)
  62. vread_tick_patch_end = .;
  63. }
  64. /DISCARD/ : {
  65. *(.discard)
  66. *(.discard.*)
  67. *(__bug_table)
  68. }
  69. }
  70. /*
  71. * Very old versions of ld do not recognize this name token; use the constant.
  72. */
  73. #define PT_GNU_EH_FRAME 0x6474e550
  74. /*
  75. * We must supply the ELF program headers explicitly to get just one
  76. * PT_LOAD segment, and set the flags explicitly to make segments read-only.
  77. */
  78. PHDRS
  79. {
  80. text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
  81. dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
  82. note PT_NOTE FLAGS(4); /* PF_R */
  83. eh_frame_hdr PT_GNU_EH_FRAME;
  84. }