Browse Source

lds: Support ctors/dtors with a priority

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Callum Farmer 1 năm trước cách đây
mục cha
commit
e2aa099738

+ 12 - 8
gnuefi/elf_aarch64_efi.lds

@@ -49,16 +49,20 @@ SECTIONS
     */
    . = ALIGN(16);
    _init_array = .;
-   *(SORT_BY_NAME(.init_array))
+   *(SORT(.init_array.*))
+   *(.init_array)
    _init_array_end = .;
    __CTOR_LIST__ = .;
-   *(SORT_BY_NAME(.ctors))
+   *(SORT(.ctors.*))
+   *(.ctors)
    __CTOR_END__ = .;
    __DTOR_LIST__ = .;
-   *(SORT_BY_NAME(.dtors))
+   *(SORT(.dtors.*))
+   *(.dtors)
    __DTOR_END__ = .;
    _fini_array = .;
-   *(SORT_BY_NAME(.fini_array))
+   *(SORT(.fini_array.*))
+   *(.fini_array)
    _fini_array_end = .;
 
    /* the EFI loader doesn't seem to like a .bss section, so we stick
@@ -84,10 +88,10 @@ SECTIONS
     *(.rela.got)
     *(.rela.dyn)
     *(.rela.stab)
-    *(.rela.init_array)
-    *(.rela.fini_array)
-    *(.rela.ctors)
-    *(.rela.dtors)
+    *(.rela.init_array*)
+    *(.rela.fini_array*)
+    *(.rela.ctors*)
+    *(.rela.dtors*)
 
   }
   . = ALIGN(4096);

+ 12 - 8
gnuefi/elf_arm_efi.lds

@@ -36,16 +36,20 @@ SECTIONS
     */
    . = ALIGN(16);
    _init_array = .;
-   *(SORT_BY_NAME(.init_array))
+   *(SORT(.init_array.*))
+   *(.init_array)
    _init_array_end = .;
    __CTOR_LIST__ = .;
-   *(SORT_BY_NAME(.ctors))
+   *(SORT(.ctors.*))
+   *(.ctors)
    __CTOR_END__ = .;
    __DTOR_LIST__ = .;
-   *(SORT_BY_NAME(.dtors))
+   *(SORT(.dtors.*))
+   *(.dtors)
    __DTOR_END__ = .;
    _fini_array = .;
-   *(SORT_BY_NAME(.fini_array))
+   *(SORT(.fini_array.*))
+   *(.fini_array)
    _fini_array_end = .;
 
    /* the EFI loader doesn't seem to like a .bss section, so we stick
@@ -70,10 +74,10 @@ SECTIONS
     *(.rel.got)
     *(.rel.dyn)
     *(.rel.stab)
-    *(.rel.init_array)
-    *(.rel.fini_array)
-    *(.rel.ctors)
-    *(.rel.dtors)
+    *(.rel.init_array*)
+    *(.rel.fini_array*)
+    *(.rel.ctors*)
+    *(.rel.dtors*)
 
   }
   . = ALIGN(4096);

+ 12 - 8
gnuefi/elf_ia32_efi.lds

@@ -40,16 +40,20 @@ SECTIONS
     */
    . = ALIGN(16);
    _init_array = .;
-   *(SORT_BY_NAME(.init_array))
+   *(SORT(.init_array.*))
+   *(.init_array)
    _init_array_end = .;
    __CTOR_LIST__ = .;
-   *(SORT_BY_NAME(.ctors))
+   *(SORT(.ctors.*))
+   *(.ctors)
    __CTOR_END__ = .;
    __DTOR_LIST__ = .;
-   *(SORT_BY_NAME(.dtors))
+   *(SORT(.dtors.*))
+   *(.dtors)
    __DTOR_END__ = .;
    _fini_array = .;
-   *(SORT_BY_NAME(.fini_array))
+   *(SORT(.fini_array.*))
+   *(.fini_array)
    _fini_array_end = .;
 
    /* the EFI loader doesn't seem to like a .bss section, so we stick
@@ -70,10 +74,10 @@ SECTIONS
     *(.rel.got)
     *(.rel.dyn)
     *(.rel.stab)
-    *(.rel.init_array)
-    *(.rel.fini_array)
-    *(.rel.ctors)
-    *(.rel.dtors)
+    *(.rel.init_array*)
+    *(.rel.fini_array*)
+    *(.rel.ctors*)
+    *(.rel.dtors*)
     *(.data.rel.ro.local)
     *(.data.rel.local)
     *(.data.rel.ro)

+ 12 - 8
gnuefi/elf_ia32_fbsd_efi.lds

@@ -49,16 +49,20 @@ SECTIONS
     */
    . = ALIGN(16);
    _init_array = .;
-   *(SORT_BY_NAME(.init_array))
+   *(SORT(.init_array.*))
+   *(.init_array)
    _init_array_end = .;
    __CTOR_LIST__ = .;
-   *(SORT_BY_NAME(.ctors))
+   *(SORT(.ctors.*))
+   *(.ctors)
    __CTOR_END__ = .;
    __DTOR_LIST__ = .;
-   *(SORT_BY_NAME(.dtors))
+   *(SORT(.dtors.*))
+   *(.dtors)
    __DTOR_END__ = .;
    _fini_array = .;
-   *(SORT_BY_NAME(.fini_array))
+   *(SORT(.fini_array.*))
+   *(.fini_array)
    _fini_array_end = .;
 
    /* the EFI loader doesn't seem to like a .bss section, so we stick
@@ -80,10 +84,10 @@ SECTIONS
     *(.rel.data.*)
     *(.rel.got)
     *(.rel.stab)
-    *(.rel.init_array)
-    *(.rel.fini_array)
-    *(.rel.ctors)
-    *(.rel.dtors)
+    *(.rel.init_array*)
+    *(.rel.fini_array*)
+    *(.rel.ctors*)
+    *(.rel.dtors*)
     *(.data.rel.ro.local)
     *(.data.rel.local)
     *(.data.rel.ro)

+ 12 - 8
gnuefi/elf_ia64_efi.lds

@@ -50,16 +50,20 @@ SECTIONS
     */
    . = ALIGN(16);
    _init_array = .;
-   *(SORT_BY_NAME(.init_array))
+   *(SORT(.init_array.*))
+   *(.init_array)
    _init_array_end = .;
    __CTOR_LIST__ = .;
-   *(SORT_BY_NAME(.ctors))
+   *(SORT(.ctors.*))
+   *(.ctors)
    __CTOR_END__ = .;
    __DTOR_LIST__ = .;
-   *(SORT_BY_NAME(.dtors))
+   *(SORT(.dtors.*))
+   *(.dtors)
    __DTOR_END__ = .;
    _fini_array = .;
-   *(SORT_BY_NAME(.fini_array))
+   *(SORT(.fini_array.*))
+   *(.fini_array)
    _fini_array_end = .;
 
    /* the EFI loader doesn't seem to like a .bss section, so we stick
@@ -82,10 +86,10 @@ SECTIONS
     *(.rela.dyn)
     *(.rela.gnu.linkonce.d*)
     *(.rela.stab)
-    *(.rela.init_array)
-    *(.rela.fini_array)
-    *(.rela.ctors)
-    *(.rela.dtors)
+    *(.rela.init_array*)
+    *(.rela.fini_array*)
+    *(.rela.ctors*)
+    *(.rela.dtors*)
   }
   . = ALIGN(4096);
   .rela.plt : { *(.rela.plt) }

+ 12 - 8
gnuefi/elf_mips64el_efi.lds

@@ -37,16 +37,20 @@ SECTIONS
     */
    . = ALIGN(16);
    _init_array = .;
-   *(SORT_BY_NAME(.init_array))
+   *(SORT(.init_array.*))
+   *(.init_array)
    _init_array_end = .;
    __CTOR_LIST__ = .;
-   *(SORT_BY_NAME(.ctors))
+   *(SORT(.ctors.*))
+   *(.ctors)
    __CTOR_END__ = .;
    __DTOR_LIST__ = .;
-   *(SORT_BY_NAME(.dtors))
+   *(SORT(.dtors.*))
+   *(.dtors)
    __DTOR_END__ = .;
    _fini_array = .;
-   *(SORT_BY_NAME(.fini_array))
+   *(SORT(.fini_array.*))
+   *(.fini_array)
    _fini_array_end = .;
 
    /* the EFI loader doesn't seem to like a .bss section, so we stick
@@ -70,10 +74,10 @@ SECTIONS
     *(.rel.got)
     *(.rel.dyn)
     *(.rel.stab)
-    *(.rel.init_array)
-    *(.rel.fini_array)
-    *(.rel.ctors)
-    *(.rel.dtors)
+    *(.rel.init_array*)
+    *(.rel.fini_array*)
+    *(.rel.ctors*)
+    *(.rel.dtors*)
   }
   . = ALIGN(4096);
   .rel.plt : { *(.rel.plt) }

+ 12 - 8
gnuefi/elf_x86_64_efi.lds

@@ -47,16 +47,20 @@ SECTIONS
     */
    . = ALIGN(16);
    _init_array = .;
-   *(SORT_BY_NAME(.init_array))
+   *(SORT(.init_array.*))
+   *(.init_array)
    _init_array_end = .;
    __CTOR_LIST__ = .;
-   *(SORT_BY_NAME(.ctors))
+   *(SORT(.ctors.*))
+   *(.ctors)
    __CTOR_END__ = .;
    __DTOR_LIST__ = .;
-   *(SORT_BY_NAME(.dtors))
+   *(SORT(.dtors.*))
+   *(.dtors)
    __DTOR_END__ = .;
    _fini_array = .;
-   *(SORT_BY_NAME(.fini_array))
+   *(SORT(.fini_array.*))
+   *(.fini_array)
    _fini_array_end = .;
 
    /* the EFI loader doesn't seem to like a .bss section, so we stick
@@ -82,10 +86,10 @@ SECTIONS
     *(.rela.got)
     *(.rela.dyn)
     *(.rela.stab)
-    *(.rela.init_array)
-    *(.rela.fini_array)
-    *(.rela.ctors)
-    *(.rela.dtors)
+    *(.rela.init_array*)
+    *(.rela.fini_array*)
+    *(.rela.ctors*)
+    *(.rela.dtors*)
   }
   . = ALIGN(4096);
   .rela.plt : { *(.rela.plt) }

+ 12 - 8
gnuefi/elf_x86_64_fbsd_efi.lds

@@ -45,16 +45,20 @@ SECTIONS
     */
    . = ALIGN(16);
    _init_array = .;
-   *(SORT_BY_NAME(.init_array))
+   *(SORT(.init_array.*))
+   *(.init_array)
    _init_array_end = .;
    __CTOR_LIST__ = .;
-   *(SORT_BY_NAME(.ctors))
+   *(SORT(.ctors.*))
+   *(.ctors)
    __CTOR_END__ = .;
    __DTOR_LIST__ = .;
-   *(SORT_BY_NAME(.dtors))
+   *(SORT(.dtors.*))
+   *(.dtors)
    __DTOR_END__ = .;
    _fini_array = .;
-   *(SORT_BY_NAME(.fini_array))
+   *(SORT(.fini_array.*))
+   *(.fini_array)
    _fini_array_end = .;
 
    /* the EFI loader doesn't seem to like a .bss section, so we stick
@@ -76,10 +80,10 @@ SECTIONS
     *(.rela.data*)
     *(.rela.got)
     *(.rela.stab)
-    *(.rela.init_array)
-    *(.rela.fini_array)
-    *(.rela.ctors)
-    *(.rela.dtors)
+    *(.rela.init_array*)
+    *(.rela.fini_array*)
+    *(.rela.ctors*)
+    *(.rela.dtors*)
   }
   _edata = .;
   _data_size = . - _etext;