[PATCH v4 09/11] libgloss: mips: g++ exception handling failure on o32 elf targets
Jovan Dmitrovic <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
From: Faraz Shahbazker <[email protected]> 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ć <[email protected]> --- libgloss/mips/uhi32.ld | 9 ++++++++- libgloss/mips/uhi64_64.ld | 8 +++++++- libgloss/mips/uhi64_n32.ld | 8 +++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/libgloss/mips/uhi32.ld b/libgloss/mips/uhi32.ld index 96f697add..ae3536ead 100644 --- a/libgloss/mips/uhi32.ld +++ b/libgloss/mips/uhi32.ld @@ -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)) } diff --git a/libgloss/mips/uhi64_64.ld b/libgloss/mips/uhi64_64.ld index 1aece1bf2..e6c3bee89 100644 --- a/libgloss/mips/uhi64_64.ld +++ b/libgloss/mips/uhi64_64.ld @@ -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)) } diff --git a/libgloss/mips/uhi64_n32.ld b/libgloss/mips/uhi64_n32.ld index 2ca0b4c11..25cdd06ca 100644 --- a/libgloss/mips/uhi64_n32.ld +++ b/libgloss/mips/uhi64_n32.ld @@ -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)) } -- 2.34.1