{simple,shoddy,smart} minsize-oriented linker
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.3 KiB

4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
1 year ago
4 years ago
3 years ago
  1. /*OUTPUT_FORMAT(binary)*/
  2. ENTRY(_smol_start)
  3. PHDRS {
  4. dyn PT_DYNAMIC FLAGS(0); /* --- */
  5. interp PT_INTERP FLAGS(0); /* --- */
  6. rodttxt PT_LOAD FLAGS(5); /* r-x */
  7. rwdt PT_LOAD FLAGS(6); /* rw- */
  8. }
  9. SECTIONS {
  10. . = 0x10000;
  11. _smol_origin = .;
  12. .header : { KEEP(*(.header)) } :rodttxt
  13. .dynamic : { *(.dynamic .rodata.dynamic) } :dyn :rodttxt
  14. .interp : { *(.interp .rodata.interp) } :interp /*:rodttxt*/
  15. _smol_text_start = .;
  16. _smol_text_off = _smol_text_start - _smol_origin;
  17. .text : {
  18. KEEP(*(.rodata.dynamic))
  19. KEEP(*(.rodata.interp .rodata.neededlibs))
  20. *(.rdata .rdata.* .rodata .rodata.*)
  21. KEEP(*(.text.startup.smol))
  22. KEEP(*(.text.startup._start))
  23. *(.text .text.*)
  24. } :rodttxt
  25. _smol_text_end = .;
  26. _smol_text_size = _smol_text_end - _smol_text_start;
  27. _smol_textandheader_size = _smol_text_end - _smol_origin;
  28. _smol_data_start = .;
  29. _smol_data_off = _smol_data_start - _smol_origin;
  30. .data : {
  31. KEEP(*(.data.smolgot))
  32. *(.data .data.* .tdata .tdata.*)
  33. } :rwdt
  34. .dynstuff : { *(.symtab .strtab .shstrtab .rel.text .got.plt .gnu.linkonce.* .plt .plt.got) } /*:dyn*/ :rodttxt
  35. _smol_data_end = .;
  36. _smol_data_size = _smol_data_end - _smol_data_start;
  37. _smol_total_filesize = . - _smol_origin;
  38. _smol_bss_start = .;
  39. _smol_bss_off = _smol_bss_start - _smol_origin;
  40. .bss : {
  41. *(.bss .bss.* .tbss .tbss.* .sbss .sbss.*)
  42. } :rwdt
  43. _smol_bss_end = .;
  44. _smol_bss_size = _smol_bss_end - _smol_bss_start;
  45. _smol_dataandbss_size = _smol_bss_end - _smol_data_start;
  46. _smol_total_memsize = . - _smol_origin;
  47. /* Stabs debugging sections. */
  48. .stab 0 : { *(.stab) }
  49. .stabstr 0 : { *(.stabstr) }
  50. .stab.excl 0 : { *(.stab.excl) }
  51. .stab.exclstr 0 : { *(.stab.exclstr) }
  52. .stab.index 0 : { *(.stab.index) }
  53. .stab.indexstr 0 : { *(.stab.indexstr) }
  54. /*.comment 0 : { *(.comment) }*/
  55. /*.gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }*/
  56. /* DWARF debug sections.
  57. Symbols in the DWARF debugging sections are relative to the beginning
  58. of the section so we begin them at 0. */
  59. /* DWARF 1 */
  60. .debug 0 : { *(.debug) }
  61. .line 0 : { *(.line) }
  62. /* GNU DWARF 1 extensions */
  63. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  64. .debug_sfnames 0 : { *(.debug_sfnames) }
  65. /* DWARF 1.1 and DWARF 2 */
  66. .debug_aranges 0 : { *(.debug_aranges) }
  67. .debug_pubnames 0 : { *(.debug_pubnames) }
  68. /* DWARF 2 */
  69. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  70. .debug_abbrev 0 : { *(.debug_abbrev) }
  71. .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) }
  72. .debug_frame 0 : { *(.debug_frame) }
  73. .debug_str 0 : { *(.debug_str) }
  74. .debug_loc 0 : { *(.debug_loc) }
  75. .debug_macinfo 0 : { *(.debug_macinfo) }
  76. /* SGI/MIPS DWARF 2 extensions */
  77. .debug_weaknames 0 : { *(.debug_weaknames) }
  78. .debug_funcnames 0 : { *(.debug_funcnames) }
  79. .debug_typenames 0 : { *(.debug_typenames) }
  80. .debug_varnames 0 : { *(.debug_varnames) }
  81. /* DWARF 3 */
  82. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  83. .debug_ranges 0 : { *(.debug_ranges) }
  84. /* DWARF Extension. */
  85. .debug_macro 0 : { *(.debug_macro) }
  86. .debug_addr 0 : { *(.debug_addr) }
  87. /*.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }*/
  88. /DISCARD/ : {
  89. *(.*)
  90. }
  91. }