vdso.lds.S 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Linker script for vsyscall DSO. The vsyscall page is an ELF shared
  3. * object prelinked to its virtual address, and with only one read-only
  4. * segment (that fits in one page). This script controls its layout.
  5. */
  6. #include <asm/asm-offsets.h>
  7. #include "voffset.h"
  8. #define VDSO_PRELINK 0xffffffffff700000
  9. /*
  10. * Symbols we define here called VDSO* get their values into vdso-syms.lds
  11. * and become visible to the kernel itself.
  12. */
  13. VDSO64_PRELINK = VDSO_PRELINK;
  14. #define VEXTERN(x) VDSO64_ ## x = vdso_ ## x;
  15. #include "vextern.h"
  16. #undef VEXTERN
  17. SECTIONS
  18. {
  19. . = VDSO_PRELINK + SIZEOF_HEADERS;
  20. .hash : { *(.hash) } :text
  21. .gnu.hash : { *(.gnu.hash) }
  22. .dynsym : { *(.dynsym) }
  23. .dynstr : { *(.dynstr) }
  24. .gnu.version : { *(.gnu.version) }
  25. .gnu.version_d : { *(.gnu.version_d) }
  26. .gnu.version_r : { *(.gnu.version_r) }
  27. /* This linker script is used both with -r and with -shared.
  28. For the layouts to match, we need to skip more than enough
  29. space for the dynamic symbol table et al. If this amount
  30. is insufficient, ld -shared will barf. Just increase it here. */
  31. . = VDSO_PRELINK + VDSO_TEXT_OFFSET;
  32. .text : { *(.text*) } :text
  33. .rodata : { *(.rodata*) } :text
  34. .data : {
  35. *(.data*)
  36. *(.sdata*)
  37. *(.bss*)
  38. *(.dynbss*)
  39. } :text
  40. .altinstructions : { *(.altinstructions) } :text
  41. .altinstr_replacement : { *(.altinstr_replacement) } :text
  42. .note : { *(.note.*) } :text :note
  43. .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
  44. .eh_frame : { KEEP (*(.eh_frame)) } :text
  45. .dynamic : { *(.dynamic) } :text :dynamic
  46. .useless : {
  47. *(.got.plt) *(.got)
  48. *(.gnu.linkonce.d.*)
  49. *(.gnu.linkonce.b.*)
  50. } :text
  51. }
  52. /*
  53. * We must supply the ELF program headers explicitly to get just one
  54. * PT_LOAD segment, and set the flags explicitly to make segments read-only.
  55. */
  56. PHDRS
  57. {
  58. text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
  59. dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
  60. note PT_NOTE FLAGS(4); /* PF_R */
  61. eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
  62. }
  63. /*
  64. * This controls what symbols we export from the DSO.
  65. */
  66. VERSION
  67. {
  68. LINUX_2.6 {
  69. global:
  70. clock_gettime;
  71. __vdso_clock_gettime;
  72. gettimeofday;
  73. __vdso_gettimeofday;
  74. getcpu;
  75. __vdso_getcpu;
  76. local: *;
  77. };
  78. }