| 1 | This fixes static linking for our hardened toolchain
|
| 2 | diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
|
| 3 | index e8126cb..9532bfb 100644
|
| 4 | |
| 5 | |
| 6 | @@ -235,8 +235,8 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
|
| 7 | if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
|
| 8 | SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
|
| 9 | SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
|
| 10 | - CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors"
|
| 11 | - DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors"
|
| 12 | + CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .ctors"
|
| 13 | + DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .dtors"
|
| 14 | else
|
| 15 | SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))"
|
| 16 | SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))"
|
| 17 | @@ -270,15 +270,14 @@ CTOR=".ctors ${CONSTRUCTING-0} :
|
| 18 | doesn't matter which directory crtbegin.o
|
| 19 | is in. */
|
| 20 |
|
| 21 | - KEEP (*crtbegin.o(.ctors))
|
| 22 | - KEEP (*crtbegin?.o(.ctors))
|
| 23 | + KEEP (*crtbegin*.o(.ctors))
|
| 24 |
|
| 25 | /* We don't want to include the .ctor section from
|
| 26 | the crtend.o file until after the sorted ctors.
|
| 27 | The .ctor section from the crtend file contains the
|
| 28 | end of ctors marker and it must be last */
|
| 29 |
|
| 30 | - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
|
| 31 | + KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors))
|
| 32 | KEEP (*(SORT(.ctors.*)))
|
| 33 | KEEP (*(.ctors))
|
| 34 | ${CONSTRUCTING+${CTOR_END}}
|
| 35 | @@ -286,9 +285,8 @@ CTOR=".ctors ${CONSTRUCTING-0} :
|
| 36 | DTOR=".dtors ${CONSTRUCTING-0} :
|
| 37 | {
|
| 38 | ${CONSTRUCTING+${DTOR_START}}
|
| 39 | - KEEP (*crtbegin.o(.dtors))
|
| 40 | - KEEP (*crtbegin?.o(.dtors))
|
| 41 | - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
|
| 42 | + KEEP (*crtbegin*.o(.dtors))
|
| 43 | + KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors))
|
| 44 | KEEP (*(SORT(.dtors.*)))
|
| 45 | KEEP (*(.dtors))
|
| 46 | ${CONSTRUCTING+${DTOR_END}}
|