[PATCH] or1k: add KEEP section directives to the linkcmds

Hesham Almatary heshamelmatary at gmail.com
Tue Apr 5 06:37:26 UTC 2016


From: Hesham Almatary <heshamelmatary at gmail.com>

---
 c/src/lib/libbsp/or1k/shared/startup/linkcmds.base | 86 +++++++++++-----------
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/c/src/lib/libbsp/or1k/shared/startup/linkcmds.base b/c/src/lib/libbsp/or1k/shared/startup/linkcmds.base
index 31bb92d..133ad0f 100644
--- a/c/src/lib/libbsp/or1k/shared/startup/linkcmds.base
+++ b/c/src/lib/libbsp/or1k/shared/startup/linkcmds.base
@@ -41,7 +41,7 @@ bsp_processor_count = DEFINED (bsp_processor_count) ? bsp_processor_count : 1;
 SECTIONS {
 
   .vector : ALIGN_WITH_INPUT {
-    *(.vector)
+    KEEP (*(.vector))
     . = ALIGN(bsp_vector_table_size);
     bsp_section_vector_end = .;
   } > REGION_VECTOR AT > REGION_VECTOR
@@ -63,10 +63,10 @@ SECTIONS {
 
 .text : ALIGN_WITH_INPUT {
     bsp_section_text_begin = .;
-    *(.text.unlikely .text.*_unlikely)
-    *(.text .stub .text.* .gnu.linkonce.t.*)
+    KEEP (*(.text.unlikely .text.*_unlikely))
+    KEEP (*(.text .stub .text.* .gnu.linkonce.t.*))
     /* .gnu.warning sections are handled specially by elf32.em.  */
-    *(.gnu.warning)
+    KEEP (*(.gnu.warning))
     *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
   } > REGION_TEXT AT > REGION_TEXT_LOAD
   .init : ALIGN_WITH_INPUT {
@@ -86,17 +86,17 @@ SECTIONS {
 
 .rodata : ALIGN_WITH_INPUT {
     bsp_section_rodata_begin = .;
-    *(.rodata .rodata.* .gnu.linkonce.r.*)
+    KEEP (*(.rodata .rodata.* .gnu.linkonce.r.*))
   } > REGION_RODATA AT > REGION_RODATA_LOAD
 .eh_frame : ALIGN_WITH_INPUT {
                KEEP (*(.eh_frame))
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .gcc_except_table : ALIGN_WITH_INPUT {
-               *(.gcc_except_table .gcc_except_table.*)
+               KEEP (*(.gcc_except_table .gcc_except_table.*))
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .tdata : ALIGN_WITH_INPUT {
                _TLS_Data_begin = .;
-               *(.tdata .tdata.* .gnu.linkonce.td.*)
+               KEEP (*(.tdata .tdata.* .gnu.linkonce.td.*))
                _TLS_Data_end = .;
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .tbss : ALIGN_WITH_INPUT {
@@ -189,18 +189,18 @@ SECTIONS {
                *(.gnu.version_r)
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .rel.dyn : ALIGN_WITH_INPUT {
-               *(.rel.init)
-               *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
-               *(.rel.fini)
-               *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
-               *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
-               *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
-               *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
-               *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
-               *(.rel.ctors)
-               *(.rel.dtors)
-               *(.rel.got)
-               *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
+               KEEP (*(.rel.init))
+               KEEP (*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*))
+               KEEP (*(.rel.fini))
+               KEEP (*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*))
+               KEEP (*(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*))
+               KEEP (*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*))
+               KEEP (*(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*))
+               KEEP (*(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*))
+               KEEP (*(.rel.ctors))
+               KEEP (*(.rel.dtors))
+               KEEP (*(.rel.got))
+               KEEP (*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*))
                PROVIDE_HIDDEN (__rel_iplt_start = .);
                *(.rel.iplt)
                PROVIDE_HIDDEN (__rel_iplt_end = .);
@@ -208,17 +208,17 @@ SECTIONS {
                PROVIDE_HIDDEN (__rela_iplt_end = .);
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .rela.dyn : ALIGN_WITH_INPUT {
-               *(.rela.init)
-               *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
-               *(.rela.fini)
-               *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
-               *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
-               *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
-               *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
-               *(.rela.ctors)
-               *(.rela.dtors)
-               *(.rela.got)
-               *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
+               KEEP (*(.rela.init))
+               KEEP (*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*))
+               KEEP (*(.rela.fini))
+               KEEP (*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*))
+               KEEP (*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*))
+               KEEP (*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*))
+               KEEP (*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*))
+               KEEP (*(.rela.ctors))
+               KEEP (*(.rela.dtors))
+               KEEP (*(.rela.got))
+               KEEP (*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*))
                PROVIDE_HIDDEN (__rel_iplt_start = .);
                PROVIDE_HIDDEN (__rel_iplt_end = .);
                PROVIDE_HIDDEN (__rela_iplt_start = .);
@@ -226,19 +226,19 @@ SECTIONS {
                PROVIDE_HIDDEN (__rela_iplt_end = .);
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .rel.plt : ALIGN_WITH_INPUT {
-               *(.rel.plt)
+               KEEP (*(.rel.plt))
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .rela.plt : ALIGN_WITH_INPUT {
-               *(.rela.plt)
+               KEEP (*(.rela.plt))
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .plt : ALIGN_WITH_INPUT {
-               *(.plt)
+               KEEP (*(.plt))
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .iplt : ALIGN_WITH_INPUT {
-               *(.iplt)
+               KEEP (*(.iplt))
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .dynamic : ALIGN_WITH_INPUT {
-               *(.dynamic)
+               KEEP (*(.dynamic))
        } > REGION_RODATA AT > REGION_RODATA_LOAD
        .got : ALIGN_WITH_INPUT {
                *(.got.plt) *(.igot.plt) *(.got) *(.igot)
@@ -246,10 +246,10 @@ SECTIONS {
        .rtemsroset : ALIGN_WITH_INPUT {
                /* Special FreeBSD linker set sections */
                __start_set_sysctl_set = .;
-               *(set_sysctl_*);
+               KEEP (*(set_sysctl_*));
                __stop_set_sysctl_set = .;
-               *(set_domain_*);
-               *(set_pseudo_*);
+               KEEP (*(set_domain_*));
+               KEEP (*(set_pseudo_*));
 
                KEEP (*(SORT(.rtemsroset.*)))
                bsp_section_rodata_end = .;
@@ -264,11 +264,11 @@ SECTIONS {
 
 .data : ALIGN_WITH_INPUT {
     bsp_section_data_begin = .;
-    *(.data .data.* .gnu.linkonce.d.*)
+    KEEP (*(.data .data.* .gnu.linkonce.d.*))
     SORT(CONSTRUCTORS)
   } > REGION_DATA AT > REGION_DATA_LOAD
   .data1 : ALIGN_WITH_INPUT {
-    *(.data1)
+    KEEP (*(.data1))
   } > REGION_DATA AT > REGION_DATA_LOAD
   .rtemsrwset : ALIGN_WITH_INPUT {
     KEEP (*(SORT(.rtemsrwset.*)))
@@ -280,9 +280,9 @@ SECTIONS {
 
   .bss : ALIGN_WITH_INPUT {
     bsp_section_bss_begin = .;
-    *(.dynbss)
-    *(.bss .bss.* .gnu.linkonce.b.*)
-    *(COMMON)
+    KEEP (*(.dynbss))
+    KEEP (*(.bss .bss.* .gnu.linkonce.b.*))
+    KEEP (*(COMMON))
     bsp_section_bss_end = .;
   } > REGION_BSS AT > REGION_BSS
   bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
-- 
2.8.0.rc3



More information about the devel mailing list