[19/21] mips: libgloss: g++ exception handling failure on o32 elf targets
Commit Message
From: Faraz Shahbazker <fshahbazker@wavecomp.com>
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: Faraz Shahbazker <fshahbazker@wavecomp.com>
Signed-off-by: Aleksandar Rikalo <arikalo@gmail.com>
---
libgloss/mips/uhi32.ld | 9 ++++++++-
libgloss/mips/uhi64_64.ld | 8 +++++++-
libgloss/mips/uhi64_n32.ld | 8 +++++++-
3 files changed, 22 insertions(+), 3 deletions(-)
@@ -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)) }
@@ -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)) }
@@ -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)) }