Re: Align linkerscript symbols according to ABI
authorAlan Modra <amodra@gmail.com>
Fri, 7 Jul 2023 04:03:56 +0000 (13:33 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 12 Jul 2023 00:01:40 +0000 (09:31 +0930)
Align dot before symbols defined outside of output sections.  Before _end
is already aligned.

* scripttempl/elf.sc (def_symbol): Tidy excess space.
(_edata): Align before emitting symbol when SYMBOL_ABI_ALIGNMENT.

ld/scripttempl/elf.sc

index 9e95e6b4162d5d74e694a76e8946293f9172db10..bfd8b5ed4b33614ce4f56d89107e69558409573a 100644 (file)
@@ -171,7 +171,7 @@ fi
 def_symbol()
 {
     if [ -z "${SYMBOL_ABI_ALIGNMENT}" ]; then
-       echo "${USER_LABEL_PREFIX}$1 =  . "
+       echo "${USER_LABEL_PREFIX}$1 = ."
     else
        echo "${USER_LABEL_PREFIX}$1 = ALIGN(${SYMBOL_ABI_ALIGNMENT})"
     fi
@@ -688,6 +688,7 @@ cat <<EOF
   ${SDATA_GOT+${OTHER_GOT_SECTIONS}}
   ${DATA_SDATA-${SDATA}}
   ${DATA_SDATA-${OTHER_SDATA_SECTIONS}}
+  ${RELOCATING+${SYMBOL_ABI_ALIGNMENT+. = ALIGN(${SYMBOL_ABI_ALIGNMENT});}}
   ${RELOCATING+${DATA_END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}$(def_symbol "_edata")${CREATE_SHLIB+)}; PROVIDE ($(def_symbol "edata"));}}
   ${PERSISTENT}
   ${RELOCATING+. = .;}