]> sourceware.org Git - newlib-cygwin.git/commitdiff
Fix order of eh_frame sections in linker scripts
authorFaraz Shahbazker <fshahbazker@wavecomp.com>
Sun, 28 Apr 2019 18:17:14 +0000 (18:17 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 29 Apr 2019 08:44:24 +0000 (10:44 +0200)
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.

18 files changed:
libgloss/mips/array.ld
libgloss/mips/cfe.ld
libgloss/mips/ddb-kseg0.ld
libgloss/mips/ddb.ld
libgloss/mips/dve.ld
libgloss/mips/idt.ld
libgloss/mips/idt32.ld
libgloss/mips/idt64.ld
libgloss/mips/jmr3904app.ld
libgloss/mips/lsi.ld
libgloss/mips/mti32.ld
libgloss/mips/mti64.ld
libgloss/mips/mti64_64.ld
libgloss/mips/mti64_n32.ld
libgloss/mips/nullmon.ld
libgloss/mips/pmon.ld
libgloss/mips/sde32.ld
libgloss/mips/sde64.ld

index fc4cc8fc2577ef5d7a4f458efefd52dd0eb1b48a..2bc49c71b4bb149ce0be4ba8dffb25fa7a367f36 100644 (file)
@@ -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    :
index 58e8014d77eca1a605a203047cf97461c0b59ea7..78fb8533fadbed976395af4cfb15d5b2af35c24f 100644 (file)
@@ -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    :
index db3759ea6869343df3454bdec898358c31af143c..74bc1b09c3b2d3ef55210cc962b97e4e40c83afe 100644 (file)
@@ -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    :
index 028078353611027d030cd176df2468f695ebd97b..8fcafd361d7b8dbac49af14dad1f38ce339caaa3 100644 (file)
@@ -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    :
index 073d1e9ca28f83d52f6a156b0e529fe27650cc2e..adce60f823beb9cdf060cd8d3900e6483f10d7f0 100644 (file)
@@ -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    :
index 05b39b78d23ae3f5ecde8825ab0293ceadae7755..0d69af452115779f1c0e7942d68ea9791fff30a9 100644 (file)
@@ -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    :
index 95555291e9dc9620f4f695bf9e8d8d0edc05d3e5..175a98b61dc4dff607657199da4cd68babbd001b 100644 (file)
@@ -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    :
index 4a958202f991d9288ea98b2ede664710daf68f3b..bd217e535441035731e80c6c4a1dd2c2cd5e05d4 100644 (file)
@@ -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    :
index 3056a36bfbed28f17528f2e668c8d9eeca934154..d5b31091819b43287c5a3a7053cef77e93cc4267 100644 (file)
@@ -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    :
index 8393825276427bfb75343b3e9cb79605866f2404..ca64ab92710fe82115dfbb80b12f7f35c9990295 100644 (file)
@@ -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    :
index 2739c620f5588bcd43da28fc7d3dc040520e669c..41592d12a2351512f024a9e4e43f88c79aa126c6 100644 (file)
@@ -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    :
index 15975ad89fb494941e0abe94da788c1435defb35..8a47c4760be89ae891173a0c29bba445ce302384 100644 (file)
@@ -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    :
index 7a2074f1ae34b38ac11fc34d4ad88a1d74aaaa78..81704f0654d02a8e5e7f6ed18fb6d4f6ac3bf40c 100644 (file)
@@ -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    :
index 4003845e0a8e7551f05d1048db081e670415769a..6c53809349643ee689ab61e4fe909d74c775b1a1 100644 (file)
@@ -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    :
index c90aed308a20a3b5f7f14eed1e74c8b751cd877f..14b0d0e599c7f4049d10f461c6ad5cc64d7d6899 100644 (file)
@@ -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    :
index 81fd8ee31c7d78ed405f13b35a1176a11f63858e..244c1f65b3d132c032d40ea824dc9dcd1a825306 100644 (file)
@@ -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    :
index 715639ef50b1db7722bf5dc2b9ebadee228cd2eb..657f5f31b065886486593f2e4ef9b2f214bbc79e 100644 (file)
@@ -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    :
index 1bd11f6f88a70ba48da470beb8595fb513e877ff..e3a0f298b36455603974def0c4f8bb21f4030732 100644 (file)
@@ -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    :
This page took 0.056162 seconds and 5 git commands to generate.