vdso.lds.S 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. SECTIONS
  10. {
  11. . = VDSO_PRELINK + SIZEOF_HEADERS;
  12. .hash : { *(.hash) } :text
  13. .gnu.hash : { *(.gnu.hash) }
  14. .dynsym : { *(.dynsym) }
  15. .dynstr : { *(.dynstr) }
  16. .gnu.version : { *(.gnu.version) }
  17. .gnu.version_d : { *(.gnu.version_d) }
  18. .gnu.version_r : { *(.gnu.version_r) }
  19. /* This linker script is used both with -r and with -shared.
  20. For the layouts to match, we need to skip more than enough
  21. space for the dynamic symbol table et al. If this amount
  22. is insufficient, ld -shared will barf. Just increase it here. */
  23. . = VDSO_PRELINK + VDSO_TEXT_OFFSET;
  24. .text : { *(.text*) } :text
  25. .rodata : { *(.rodata*) } :text
  26. .data : {
  27. *(.data*)
  28. *(.sdata*)
  29. *(.bss*)
  30. *(.dynbss*)
  31. } :text
  32. .altinstructions : { *(.altinstructions) } :text
  33. .altinstr_replacement : { *(.altinstr_replacement) } :text
  34. .note : { *(.note.*) } :text :note
  35. .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
  36. .eh_frame : { KEEP (*(.eh_frame)) } :text
  37. .dynamic : { *(.dynamic) } :text :dynamic
  38. .useless : {
  39. *(.got.plt) *(.got)
  40. *(.gnu.linkonce.d.*)
  41. *(.gnu.linkonce.b.*)
  42. } :text
  43. }
  44. /*
  45. * We must supply the ELF program headers explicitly to get just one
  46. * PT_LOAD segment, and set the flags explicitly to make segments read-only.
  47. */
  48. PHDRS
  49. {
  50. text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
  51. dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
  52. note PT_NOTE FLAGS(4); /* PF_R */
  53. eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
  54. }
  55. /*
  56. * This controls what symbols we export from the DSO.
  57. */
  58. VERSION
  59. {
  60. LINUX_2.6 {
  61. global:
  62. clock_gettime;
  63. __vdso_clock_gettime;
  64. gettimeofday;
  65. __vdso_gettimeofday;
  66. getcpu;
  67. __vdso_getcpu;
  68. local: *;
  69. };
  70. }