{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.
 
 
 
 
 

63 lines
1.7 KiB

OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_smol_start)
SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib64"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib");
/*OUTPUT_FORMAT(binary)*/
PHDRS {
rodttxt PT_LOAD FLAGS(5); /* r-x */
rwdt PT_LOAD FLAGS(6); /* rw- */
}
SECTIONS {
. = 0x10000;
_smol_origin = .;
.header : { KEEP(*(.header)) } :rodttxt
_smol_text_start = .;
_smol_text_off = _smol_text_start - _smol_origin;
.text : {
KEEP(*(.rodata.dynamic))
KEEP(*(.rodata.interp .rodata.neededlibs))
*(.rdata .rdata.* .rodata .rodata.*)
KEEP(*(.text.startup.smol))
KEEP(*(.text.startup._start))
*(.text .text.*)
} :rodttxt
_smol_text_end = .;
_smol_text_size = _smol_text_end - _smol_text_start;
_smol_textandheader_size = _smol_text_end - _smol_origin;
_smol_data_start = .;
_smol_data_off = _smol_data_start - _smol_origin;
.data : {
KEEP(*(.data.smolgot))
*(.data .data.* .tdata .tdata.*)
} :rwdt
.dynamic : { *(.dynamic) } :rodttxt :dyn
.dynstuff : { *(.symtab .strtab .shstrtab .rel.text .got.plt .gnu.linkonce.* .plt .plt.got .interp) } :rodttxt
_smol_data_end = .;
_smol_data_size = _smol_data_end - _smol_data_start;
_smol_total_filesize = . - _smol_origin;
_smol_bss_start = .;
_smol_bss_off = _smol_bss_start - _smol_origin;
.bss : {
*(.bss .bss.* .tbss .tbss.* .sbss .sbss.*)
} :rwdt
_smol_bss_end = .;
_smol_bss_size = _smol_bss_end - _smol_bss_start;
_smol_dataandbss_size = _smol_bss_end - _smol_data_start;
/DISCARD/ : {
*(.*)
}
_smol_total_memsize = . - _smol_origin;
}