public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Fix order of eh_frame sections in linker scripts
Date: Mon, 29 Apr 2019 08:44:00 -0000	[thread overview]
Message-ID: <20190429084433.58950.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ab2901c843c2b9226f9319a8242fffbdf002e8bc

commit ab2901c843c2b9226f9319a8242fffbdf002e8bc
Author: Faraz Shahbazker <fshahbazker@wavecomp.com>
Date:   Sun Apr 28 18:17:14 2019 +0000

    Fix order of eh_frame sections in linker scripts
    
    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 are placed after crtend.o and the
    end-of-frame marker provided by crtend.o ends up in between .eh_frames
    instead of being at the end.
    
    This has always been a problem, but a 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_frames in all
    MIPS linker scripts so that the one from crtend.o is always placed last.
    
    libgloss/
    	* mips/array.ld: Re-order to place .eh_frame from crtend.o
    	after all other .eh_frame sections.
    	* mips/cfe.ld: Likewise.
    	* mips/ddb-kseg0.ld: Likewise.
    	* mips/ddb.ld: Likewise.
    	* mips/dve.ld: Likewise.
    	* mips/idt.ld: Likewise.
    	* mips/idt32.ld: Likewise.
    	* mips/idt64.ld: Likewise.
    	* mips/jmr3904app.ld: Likewise.
    	* mips/lsi.ld: Likewise.
    	* mips/mti32.ld: Likewise.
    	* mips/mti64.ld: Likewise.
    	* mips/mti64_64.ld: Likewise.
    	* mips/mti64_n32.ld: Likewise.
    	* mips/nullmon.ld: Likewise.
    	* mips/pmon.ld: Likewise.
    	* mips/sde32.ld: Likewise.
    	* mips/sde64.ld: Likewise.

Diff:
---
 libgloss/mips/array.ld      | 7 ++++++-
 libgloss/mips/cfe.ld        | 8 +++++++-
 libgloss/mips/ddb-kseg0.ld  | 7 ++++++-
 libgloss/mips/ddb.ld        | 7 ++++++-
 libgloss/mips/dve.ld        | 8 +++++++-
 libgloss/mips/idt.ld        | 8 +++++++-
 libgloss/mips/idt32.ld      | 7 ++++++-
 libgloss/mips/idt64.ld      | 7 ++++++-
 libgloss/mips/jmr3904app.ld | 7 ++++++-
 libgloss/mips/lsi.ld        | 7 ++++++-
 libgloss/mips/mti32.ld      | 7 ++++++-
 libgloss/mips/mti64.ld      | 8 +++++++-
 libgloss/mips/mti64_64.ld   | 8 +++++++-
 libgloss/mips/mti64_n32.ld  | 8 +++++++-
 libgloss/mips/nullmon.ld    | 8 +++++++-
 libgloss/mips/pmon.ld       | 8 +++++++-
 libgloss/mips/sde32.ld      | 8 +++++++-
 libgloss/mips/sde64.ld      | 8 +++++++-
 18 files changed, 118 insertions(+), 18 deletions(-)

diff --git a/libgloss/mips/array.ld b/libgloss/mips/array.ld
index fc4cc8f..2bc49c7 100644
--- a/libgloss/mips/array.ld
+++ b/libgloss/mips/array.ld
@@ -100,7 +100,12 @@ SECTIONS
   }
   
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/cfe.ld b/libgloss/mips/cfe.ld
index 58e8014..78fb853 100644
--- a/libgloss/mips/cfe.ld
+++ b/libgloss/mips/cfe.ld
@@ -55,7 +55,13 @@ SECTIONS
   _etext  =  .;
   
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/ddb-kseg0.ld b/libgloss/mips/ddb-kseg0.ld
index db3759e..74bc1b0 100644
--- a/libgloss/mips/ddb-kseg0.ld
+++ b/libgloss/mips/ddb-kseg0.ld
@@ -49,7 +49,12 @@ SECTIONS
   }
   
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/ddb.ld b/libgloss/mips/ddb.ld
index 0280783..8fcafd3 100644
--- a/libgloss/mips/ddb.ld
+++ b/libgloss/mips/ddb.ld
@@ -49,7 +49,12 @@ SECTIONS
   }
   
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/dve.ld b/libgloss/mips/dve.ld
index 073d1e9..adce60f 100644
--- a/libgloss/mips/dve.ld
+++ b/libgloss/mips/dve.ld
@@ -49,7 +49,13 @@ SECTIONS
   }
   
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/idt.ld b/libgloss/mips/idt.ld
index 05b39b7..0d69af4 100644
--- a/libgloss/mips/idt.ld
+++ b/libgloss/mips/idt.ld
@@ -56,7 +56,13 @@ SECTIONS
   _etext  =  .;
   
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/idt32.ld b/libgloss/mips/idt32.ld
index 9555529..175a98b 100644
--- a/libgloss/mips/idt32.ld
+++ b/libgloss/mips/idt32.ld
@@ -58,7 +58,12 @@ SECTIONS
 
 
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/idt64.ld b/libgloss/mips/idt64.ld
index 4a95820..bd217e5 100644
--- a/libgloss/mips/idt64.ld
+++ b/libgloss/mips/idt64.ld
@@ -59,7 +59,12 @@ SECTIONS
   _etext  =  .;
 
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/jmr3904app.ld b/libgloss/mips/jmr3904app.ld
index 3056a36..d5b3109 100644
--- a/libgloss/mips/jmr3904app.ld
+++ b/libgloss/mips/jmr3904app.ld
@@ -48,7 +48,12 @@ SECTIONS
   }
   
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/lsi.ld b/libgloss/mips/lsi.ld
index 8393825..ca64ab9 100644
--- a/libgloss/mips/lsi.ld
+++ b/libgloss/mips/lsi.ld
@@ -48,7 +48,12 @@ SECTIONS
   }
   
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/mti32.ld b/libgloss/mips/mti32.ld
index 2739c62..41592d1 100644
--- a/libgloss/mips/mti32.ld
+++ b/libgloss/mips/mti32.ld
@@ -57,7 +57,12 @@ SECTIONS
   _etext  =  .;
 
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/mti64.ld b/libgloss/mips/mti64.ld
index 15975ad..8a47c47 100644
--- a/libgloss/mips/mti64.ld
+++ b/libgloss/mips/mti64.ld
@@ -59,7 +59,13 @@ SECTIONS
   _etext  =  .;
 
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/mti64_64.ld b/libgloss/mips/mti64_64.ld
index 7a2074f..81704f0 100644
--- a/libgloss/mips/mti64_64.ld
+++ b/libgloss/mips/mti64_64.ld
@@ -62,7 +62,13 @@ SECTIONS
   _etext  =  .;
 
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/mti64_n32.ld b/libgloss/mips/mti64_n32.ld
index 4003845..6c53809 100644
--- a/libgloss/mips/mti64_n32.ld
+++ b/libgloss/mips/mti64_n32.ld
@@ -62,7 +62,13 @@ SECTIONS
   _etext  =  .;
 
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/nullmon.ld b/libgloss/mips/nullmon.ld
index c90aed3..14b0d0e 100644
--- a/libgloss/mips/nullmon.ld
+++ b/libgloss/mips/nullmon.ld
@@ -50,7 +50,13 @@ SECTIONS
   }
   
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/pmon.ld b/libgloss/mips/pmon.ld
index 81fd8ee..244c1f6 100644
--- a/libgloss/mips/pmon.ld
+++ b/libgloss/mips/pmon.ld
@@ -50,7 +50,13 @@ SECTIONS
   }
   
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/sde32.ld b/libgloss/mips/sde32.ld
index 715639e..657f5f3 100644
--- a/libgloss/mips/sde32.ld
+++ b/libgloss/mips/sde32.ld
@@ -57,7 +57,13 @@ SECTIONS
   _etext  =  .;
 
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :
diff --git a/libgloss/mips/sde64.ld b/libgloss/mips/sde64.ld
index 1bd11f6..e3a0f29 100644
--- a/libgloss/mips/sde64.ld
+++ b/libgloss/mips/sde64.ld
@@ -59,7 +59,13 @@ SECTIONS
   _etext  =  .;
 
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .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) }
   .jcr : { KEEP (*(.jcr)) }
   .ctors    :


                 reply	other threads:[~2019-04-29  8:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190429084433.58950.qmail@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).