[5/7] ld:pru: Switch to init_array linker script

Message ID 20180428192827.18401-5-dimitar@dinux.eu
State Superseded
Headers show
Series
  • [1/7] bfd:pru: Fix LDI32 relocation to conform to TI ABI
Related show

Commit Message

Dimitar Dimitrov April 28, 2018, 7:28 p.m.
The TI toolchain uses init_array, so let's make this the default
to be compatible. The not-yet-mainlined newlib/libgloss port has
been updated accordingly.

2018-04-26  Dimitar Dimitrov  <dimitar@dinux.eu>

        * scripttempl/pru.sc: Switch to init_array.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>

---
 ld/scripttempl/pru.sc | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

-- 
2.11.0

Patch

diff --git a/ld/scripttempl/pru.sc b/ld/scripttempl/pru.sc
index 7e87e20191..f64e0b791e 100644
--- a/ld/scripttempl/pru.sc
+++ b/ld/scripttempl/pru.sc
@@ -72,16 +72,16 @@  SECTIONS
       ${RELOCATING+*(.rela.data:*)}
       ${RELOCATING+*(.rela.gnu.linkonce.d*)}
     }
-  .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)	}
-  .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)	}
-  .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)	}
-  .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)	}
-  .rel.got     ${RELOCATING-0} : { *(.rel.got)		}
-  .rela.got    ${RELOCATING-0} : { *(.rela.got)		}
-  .rel.bss     ${RELOCATING-0} : { *(.rel.bss)		}
-  .rela.bss    ${RELOCATING-0} : { *(.rela.bss)		}
-  .rel.plt     ${RELOCATING-0} : { *(.rel.plt)		}
-  .rela.plt    ${RELOCATING-0} : { *(.rela.plt)		}
+  .rel.init_array   	${RELOCATING-0} : { *(.rel.init_array)	}
+  .rela.init_array  	${RELOCATING-0} : { *(.rela.init_array)	}
+  .rel.fini_array   	${RELOCATING-0} : { *(.rel.fini_array)	}
+  .rela.fini_array  	${RELOCATING-0} : { *(.rela.fini_array)	}
+  .rel.got     		${RELOCATING-0} : { *(.rel.got)		}
+  .rela.got    		${RELOCATING-0} : { *(.rela.got)	}
+  .rel.bss     		${RELOCATING-0} : { *(.rel.bss)		}
+  .rela.bss    		${RELOCATING-0} : { *(.rela.bss)	}
+  .rel.plt     		${RELOCATING-0} : { *(.rel.plt)		}
+  .rela.plt    		${RELOCATING-0} : { *(.rela.plt)	}
 
   /* Internal text space.  */
   .text ${RELOCATING-0} :
@@ -113,14 +113,14 @@  SECTIONS
 
     /* CRT is prepared for constructor/destructor table to have
        a "valid" NULL address.  */
-    ${CONSTRUCTING+ _ctors_start = . ; }
-    ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.ctors.*)))}
-    ${CONSTRUCTING+ KEEP (*(.ctors))}
-    ${CONSTRUCTING+ _ctors_end = . ; }
-    ${CONSTRUCTING+ _dtors_start = . ; }
-    ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.dtors.*)))}
-    ${CONSTRUCTING+ KEEP (*(.dtors))}
-    ${CONSTRUCTING+ _dtors_end = . ; }
+    ${CONSTRUCTING+ __init_array_begin = . ; }
+    ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))}
+    ${CONSTRUCTING+ KEEP (*(.init_array))}
+    ${CONSTRUCTING+ __init_array_end = . ; }
+    ${CONSTRUCTING+ __fini_array_begin = . ; }
+    ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))}
+    ${CONSTRUCTING+ KEEP (*(.fini_array))}
+    ${CONSTRUCTING+ __fini_array_end = . ; }
 
     /* DATA memory starts at address 0.  So to avoid placing a valid static
        variable at the invalid NULL address, we introduce the .data.atzero