libgloss: mips: g++ exception handling failure on o32 elf targets
authorFaraz Shahbazker <fshahbazker@wavecomp.com>
Wed, 21 Nov 2018 18:33:47 +0000 (10:33 -0800)
committerJeff Johnston <jjohnstn@redhat.com>
Sat, 5 Jul 2025 01:25:52 +0000 (21:25 -0400)
The compiler driver positions the linker script at the end of the linker
command-line, after crtend.o. As a result, any INPUT objects and archive
GROUPs introduced by the linker script end up after crtend.o.  This messes up
the end-of-frame marker provided by crtend.o

This has always been a problem, but a recent binutils update to clean-up
redundant NULL markers in .eh_frame exposes it as a execution failure in
exception-handling tests. This patch re-orders .eh_frame in all linker
scripts so that the one from crtend.o is placed last.

An alternative approach would be to fix the compiler driver to put
the linker script before the ENDFILE spec.

Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
libgloss/mips/uhi32.ld
libgloss/mips/uhi64_64.ld
libgloss/mips/uhi64_n32.ld

index 96f697addb03b626281a2945b1ded6862da98771..ae3536eadb737596b90bc447df7677c7f9aa63be 100644 (file)
@@ -181,7 +181,14 @@ SECTIONS
   _etext  =  .;
 
   .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
-  .eh_frame : { KEEP (*(.eh_frame)) }
+  .eh_frame :
+  {
+    /* The .eh_frame section from the crtend file contains the
+       end of eh_frame marker and it must be last.  */
+    KEEP (*(EXCLUDE_FILE (*crtend.o) .eh_frame))
+    KEEP (*(.eh_frame))
+  }
+
   .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) }
   .gnu_extab : { *(.gnu_extab .gnu_extab.*) }
   .jcr : { KEEP (*(.jcr)) }
index 1aece1bf210a5209104435c4fa957a0a523b7d6e..e6c3bee893a0f5e57789c1dfff1dd48132e47fee 100644 (file)
@@ -181,7 +181,13 @@ SECTIONS
   _etext  =  .;
 
   .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
-  .eh_frame : { KEEP (*(.eh_frame)) }
+  .eh_frame :
+  {
+    /* The .eh_frame section from the crtend file contains the
+       end of eh_frame marker and it must be last.  */
+    KEEP (*(EXCLUDE_FILE (*crtend.o) .eh_frame))
+    KEEP (*(.eh_frame))
+  }
   .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) }
   .gnu_extab : { *(.gnu_extab .gnu_extab.*) }
   .jcr : { KEEP (*(.jcr)) }
index 2ca0b4c1112e2eaf256a2cf38d5c7a70ce4dbceb..25cdd06ca04208f1e8d7114dd946fe05db638a0e 100644 (file)
@@ -181,7 +181,13 @@ SECTIONS
   _etext  =  .;
 
   .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
-  .eh_frame : { KEEP (*(.eh_frame)) }
+  .eh_frame :
+  {
+    /* The .eh_frame section from the crtend file contains the
+       end of eh_frame marker and it must be last.  */
+    KEEP (*(EXCLUDE_FILE (*crtend.o) .eh_frame))
+    KEEP (*(.eh_frame))
+  }
   .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) }
   .gnu_extab : { *(.gnu_extab .gnu_extab.*) }
   .jcr : { KEEP (*(.jcr)) }
This page took 0.032081 seconds and 5 git commands to generate.