# USER_LABEL_PREFIX - prefix to add to user-visible symbols.
# RODATA_NAME, SDATA_NAME, SBSS_NAME, BSS_NAME - base parts of names
# for standard sections, without initial "." or suffixes.
+# SYMBOL_ABI_ALIGNMENT - minimum alignment in bytes which needs to be
+# applied to every symbol definition
#
# When adding sections, do note that the names of some sections are used
# when specifying the start address of the next.
GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt)${RELOCATING+ *(.igot.plt)} }"
fi
fi
+
+def_symbol()
+{
+ if [ -z "${SYMBOL_ABI_ALIGNMENT}" ]; then
+ echo "${USER_LABEL_PREFIX}$1 = . "
+ else
+ echo "${USER_LABEL_PREFIX}$1 = ALIGN(${SYMBOL_ABI_ALIGNMENT})"
+ fi
+}
+
REL_IFUNC=".rel.ifunc ${RELOCATING-0} : { *(.rel.ifunc) }"
RELA_IFUNC=".rela.ifunc ${RELOCATING-0} : { *(.rela.ifunc) }"
REL_IPLT=".rel.iplt ${RELOCATING-0} :
{
- ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN ($(def_symbol "__rel_iplt_start"));}}
*(.rel.iplt)
- ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN ($(def_symbol "__rel_iplt_end"));}}
}"
RELA_IPLT=".rela.iplt ${RELOCATING-0} :
{
- ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN ($(def_symbol "__rela_iplt_start"));}}
*(.rela.iplt)
- ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN ($(def_symbol "__rela_iplt_end"));}}
}"
DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
fi
PREINIT_ARRAY=".preinit_array :
{
- ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}
+ ${CREATE_SHLIB-PROVIDE_HIDDEN ($(def_symbol "__preinit_array_start"));}
KEEP (*(.preinit_array))
- ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}
+ ${CREATE_SHLIB-PROVIDE_HIDDEN ($(def_symbol "__preinit_array_end"));}
}"
INIT_ARRAY=".init_array :
{
- ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}
+ ${CREATE_SHLIB-PROVIDE_HIDDEN ($(def_symbol "__init_array_start"));}
${SORT_INIT_ARRAY}
KEEP (*(.init_array ${CTORS_IN_INIT_ARRAY}))
- ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}
+ ${CREATE_SHLIB-PROVIDE_HIDDEN ($(def_symbol "__init_array_end"));}
}"
FINI_ARRAY=".fini_array :
{
- ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}
+ ${CREATE_SHLIB-PROVIDE_HIDDEN ($(def_symbol "__fini_array_start"));}
${SORT_FINI_ARRAY}
KEEP (*(.fini_array ${DTORS_IN_FINI_ARRAY}))
- ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}
+ ${CREATE_SHLIB-PROVIDE_HIDDEN ($(def_symbol "__fini_array_end"));}
}"
CTOR=".ctors ${CONSTRUCTING-0} :
{
}"
STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
{
- ${RELOCATING+${USER_LABEL_PREFIX}_stack = .;}
+ ${RELOCATING+$(def_symbol "_stack");}
*(.stack)
${RELOCATING+${STACK_SENTINEL}}
}"
.rel.plt ${RELOCATING-0} :
{
*(.rel.plt)
- ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}}
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN ($(def_symbol "__rel_iplt_start"));}}}
${IREL_IN_PLT+${RELOCATING+*(.rel.iplt)}}
- ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}}
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN ($(def_symbol "__rel_iplt_end"));}}}
}
.rela.plt ${RELOCATING-0} :
{
*(.rela.plt)
- ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}}
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN ($(def_symbol "__rela_iplt_start"));}}}
${IREL_IN_PLT+${RELOCATING+*(.rela.iplt)}}
- ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}}
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN ($(def_symbol "__rela_iplt_end"));}}}
}
${OTHER_PLT_RELOC_SECTIONS}
EOF
/* Thread Local Storage sections */
.tdata ${RELOCATING-0} :
{
- ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__tdata_start = .);}}
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN ($(def_symbol "__tdata_start"));}}
*(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*})
}
.tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
${SDATA_GOT+${OTHER_GOT_SECTIONS}}
${DATA_SDATA-${SDATA}}
${DATA_SDATA-${OTHER_SDATA_SECTIONS}}
- ${RELOCATING+${DATA_END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}_edata = .${CREATE_SHLIB+)}; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
+ ${RELOCATING+${DATA_END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}$(def_symbol "_edata")${CREATE_SHLIB+)}; PROVIDE ($(def_symbol "edata"));}}
${PERSISTENT}
${RELOCATING+. = .;}
- ${RELOCATING+${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}__bss_start = .${CREATE_SHLIB+)};}
+ ${RELOCATING+${CREATE_SHLIB+PROVIDE (}$(def_symbol "__bss_start")${CREATE_SHLIB+)};}
${RELOCATING+${OTHER_BSS_SYMBOLS}}
${DATA_SDATA-${SBSS}}
${BSS_PLT+${PLT}}
${LARGE_BSS_AFTER_BSS-${LARGE_BSS}}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
${RELOCATING+${OTHER_END_SYMBOLS}}
- ${RELOCATING+${END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}_end = .${CREATE_SHLIB+)}; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
+ ${RELOCATING+${END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}$(def_symbol "_end")${CREATE_SHLIB+)}; PROVIDE ($(def_symbol "end"));}}
${RELOCATING+${DATA_SEGMENT_END}}
${TINY_DATA_SECTION}
${TINY_BSS_SECTION}