Browse Source

riscv64 lds: fix ctors/dtors

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Callum Farmer 1 năm trước cách đây
mục cha
commit
d8e6b531ef
1 tập tin đã thay đổi với 32 bổ sung4 xóa
  1. 32 4
      gnuefi/elf_riscv64_efi.lds

+ 32 - 4
gnuefi/elf_riscv64_efi.lds

@@ -31,6 +31,34 @@ SECTIONS {
 		*(.got.plt)
 		*(.got)
 
+		/*
+		* Note that these aren't the using the GNU "CONSTRUCTOR" output section
+		* command, so they don't start with a size.  Because of p2align and the
+		* end/END definitions, and the fact that they're mergeable, they can also
+		* have NULLs which aren't guaranteed to be at the end.
+		*/
+		. = ALIGN(16);
+		__init_array_start = .;
+		*(SORT(.init_array.*))
+		*(.init_array)
+		__init_array_end = .;
+		. = ALIGN(16);
+		__CTOR_LIST__ = .;
+		*(SORT(.ctors.*))
+		*(.ctors)
+		__CTOR_END__ = .;
+		. = ALIGN(16);
+		__DTOR_LIST__ = .;
+		*(SORT(.dtors.*))
+		*(.dtors)
+		__DTOR_END__ = .;
+		. = ALIGN(16);
+		__fini_array_start = .;
+		*(SORT(.fini_array.*))
+		*(.fini_array)
+		__fini_array_end = .;
+
+
 		/* the EFI loader doesn't seem to like a .bss section, so we stick
 		   it all into .data: */
 		. = ALIGN(16);
@@ -52,10 +80,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) }