vdso.lds.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * GNU linker script for the VDSO library.
  4. *
  5. * Copyright (C) 2012 ARM Limited
  6. *
  7. * Author: Will Deacon <will.deacon@arm.com>
  8. * Heavily based on the vDSO linker scripts for other archs.
  9. */
  10. #include <linux/const.h>
  11. #include <asm/page.h>
  12. #include <asm/vdso.h>
  13. #include <asm/vdso/vsyscall.h>
  14. #include <asm-generic/vmlinux.lds.h>
  15. #include <vdso/datapage.h>
  16. OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64")
  17. OUTPUT_ARCH(aarch64)
  18. SECTIONS
  19. {
  20. PROVIDE(_vdso_data = . - __VVAR_PAGES * PAGE_SIZE);
  21. PROVIDE(_vdso_rng_data = _vdso_data + __VDSO_RND_DATA_OFFSET);
  22. #ifdef CONFIG_TIME_NS
  23. PROVIDE(_timens_data = _vdso_data + PAGE_SIZE);
  24. #endif
  25. . = VDSO_LBASE + SIZEOF_HEADERS;
  26. .hash : { *(.hash) } :text
  27. .gnu.hash : { *(.gnu.hash) }
  28. .dynsym : { *(.dynsym) }
  29. .dynstr : { *(.dynstr) }
  30. .gnu.version : { *(.gnu.version) }
  31. .gnu.version_d : { *(.gnu.version_d) }
  32. .gnu.version_r : { *(.gnu.version_r) }
  33. /*
  34. * Discard .note.gnu.property sections which are unused and have
  35. * different alignment requirement from vDSO note sections.
  36. */
  37. /DISCARD/ : {
  38. *(.note.GNU-stack .note.gnu.property)
  39. *(.ARM.attributes)
  40. }
  41. .note : { *(.note.*) } :text :note
  42. . = ALIGN(16);
  43. .text : { *(.text*) } :text =0xd503201f
  44. PROVIDE (__etext = .);
  45. PROVIDE (_etext = .);
  46. PROVIDE (etext = .);
  47. . = ALIGN(4);
  48. .altinstructions : {
  49. *(.altinstructions)
  50. }
  51. .dynamic : { *(.dynamic) } :text :dynamic
  52. .rela.dyn : ALIGN(8) { *(.rela .rela*) }
  53. .rodata : {
  54. *(.rodata*)
  55. *(.got)
  56. *(.got.plt)
  57. *(.plt)
  58. *(.plt.*)
  59. *(.iplt)
  60. *(.igot .igot.plt)
  61. } :text
  62. _end = .;
  63. PROVIDE(end = .);
  64. DWARF_DEBUG
  65. ELF_DETAILS
  66. /DISCARD/ : {
  67. *(.data .data.* .gnu.linkonce.d.* .sdata*)
  68. *(.bss .sbss .dynbss .dynsbss)
  69. *(.eh_frame .eh_frame_hdr)
  70. }
  71. }
  72. /*
  73. * We must supply the ELF program headers explicitly to get just one
  74. * PT_LOAD segment, and set the flags explicitly to make segments read-only.
  75. */
  76. PHDRS
  77. {
  78. text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
  79. dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
  80. note PT_NOTE FLAGS(4); /* PF_R */
  81. }
  82. /*
  83. * This controls what symbols we export from the DSO.
  84. */
  85. VERSION
  86. {
  87. LINUX_2.6.39 {
  88. global:
  89. __kernel_rt_sigreturn;
  90. __kernel_gettimeofday;
  91. __kernel_clock_gettime;
  92. __kernel_clock_getres;
  93. __kernel_getrandom;
  94. local: *;
  95. };
  96. }
  97. /*
  98. * Make the sigreturn code visible to the kernel.
  99. */
  100. VDSO_sigtramp = __kernel_rt_sigreturn;