From b6e39e1a3296196e9f08f56a8037dab8f6536163 Mon Sep 17 00:00:00 2001 From: asava Date: Sun, 26 Apr 2020 19:01:14 +0300 Subject: [PATCH] Move ctors function pointers to .data section, and add .init_array, to fix compilation on Linux --- BaseTools/Scripts/GccBase.lds | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds index f0d8f3ff5..e81450543 100755 --- a/BaseTools/Scripts/GccBase.lds +++ b/BaseTools/Scripts/GccBase.lds @@ -45,18 +45,15 @@ SECTIONS { .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) { *(.data .data.* .gnu.linkonce.d.*) *(.bss .bss.*) + __beginning_of_section_ctors = .; /* create symbol for start of section */ + KEEP(*(.ctors .init_array)) /* .ctors is used on macOS, .init_array on Linux */ + __end_of_section_ctors = .; /* create symbol for end of section */ } .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : { KEEP (*(.eh_frame)) } - .ctorss ALIGN(CONSTANT(COMMONPAGESIZE)) : { - __beginning_of_section_ctors = .; /* create symbol for start of section */ - KEEP (*(.ctors)) - __end_of_section_ctors = .; /* create symbol for end of section */ - } - .rela (INFO) : { *(.rela .rela.*) }