svn commit: r354701 - in head/sys: conf powerpc/aim

Brandon Bergren bdragon at FreeBSD.org
Thu Nov 14 04:34:19 UTC 2019


Author: bdragon
Date: Thu Nov 14 04:34:17 2019
New Revision: 354701
URL: https://svnweb.freebsd.org/changeset/base/354701

Log:
  powerpc: Kernel fixes for ppc32 and powerpcspe w/ lld
  
  Fix wrong section ordering that was causing a ".got is not contiguous with
  other relro sections" lld error. This also brings ldscript.powerpc and
  ldscript.powerpcspe closer to ldscript.powerpc64.
  
  Also, remove unnecessary text relocs from the ppc32 AIM trap code.
  
  Approved by: jhibbits (mentor)
  Differential Revision: https://reviews.freebsd.org/D22349

Modified:
  head/sys/conf/ldscript.powerpc
  head/sys/conf/ldscript.powerpcspe
  head/sys/powerpc/aim/trap_subr32.S

Modified: head/sys/conf/ldscript.powerpc
==============================================================================
--- head/sys/conf/ldscript.powerpc	Thu Nov 14 01:38:48 2019	(r354700)
+++ head/sys/conf/ldscript.powerpc	Thu Nov 14 04:34:17 2019	(r354701)
@@ -15,6 +15,7 @@ SECTIONS
 
   .text      :
   {
+    *(.glink)
     *(.text)
     *(.stub)
     /* .gnu.warning sections are handled specially by elf32.em.  */
@@ -71,6 +72,11 @@ SECTIONS
   }
   .data1   : { *(.data1) }
   .got1           : { *(.got1) }
+  . = ALIGN(4096);
+  .got            : { *(.got) }
+  .got.plt        : { *(.got.plt) }
+
+
   .dynamic        : { *(.dynamic) }
   /* Put .ctors and .dtors next to the .got2 section, so that the pointers
      get relocated with -mrelocatable. Also put in the .fixup pointers.
@@ -87,10 +93,6 @@ SECTIONS
   .fixup          : { *(.fixup) }
                 PROVIDE (_FIXUP_END_ = .);
                 PROVIDE (_GOT2_END_ = .);
-                PROVIDE (_GOT_START_ = .);
-  .got            : { *(.got) }
-  .got.plt        : { *(.got.plt) }
-                PROVIDE (_GOT_END_ = .);
   /* We want the small data sections together, so single-instruction offsets
      can access them all, and initialized data all before uninitialized, so
      we can shorten the on-disk segment size.  */

Modified: head/sys/conf/ldscript.powerpcspe
==============================================================================
--- head/sys/conf/ldscript.powerpcspe	Thu Nov 14 01:38:48 2019	(r354700)
+++ head/sys/conf/ldscript.powerpcspe	Thu Nov 14 04:34:17 2019	(r354701)
@@ -15,6 +15,7 @@ SECTIONS
 
   .text      :
   {
+    *(.glink)
     *(.text)
     *(.stub)
     /* .gnu.warning sections are handled specially by elf32.em.  */
@@ -72,6 +73,11 @@ SECTIONS
   }
   .data1   : { *(.data1) }
   .got1           : { *(.got1) }
+  . = ALIGN(4096);
+  .got            : { *(.got) }
+  .got.plt        : { *(.got.plt) }
+
+
   .dynamic        : { *(.dynamic) }
   /* Put .ctors and .dtors next to the .got2 section, so that the pointers
      get relocated with -mrelocatable. Also put in the .fixup pointers.
@@ -88,10 +94,6 @@ SECTIONS
   .fixup          : { *(.fixup) }
                 PROVIDE (_FIXUP_END_ = .);
                 PROVIDE (_GOT2_END_ = .);
-                PROVIDE (_GOT_START_ = .);
-  .got            : { *(.got) }
-  .got.plt        : { *(.got.plt) }
-                PROVIDE (_GOT_END_ = .);
   /* We want the small data sections together, so single-instruction offsets
      can access them all, and initialized data all before uninitialized, so
      we can shorten the on-disk segment size.  */

Modified: head/sys/powerpc/aim/trap_subr32.S
==============================================================================
--- head/sys/powerpc/aim/trap_subr32.S	Thu Nov 14 01:38:48 2019	(r354700)
+++ head/sys/powerpc/aim/trap_subr32.S	Thu Nov 14 04:34:17 2019	(r354701)
@@ -302,10 +302,8 @@ CNAME(restorebridgesize) = .-CNAME(restorebridge)
  */
 	.globl	CNAME(rstcode), CNAME(rstcodeend)
 CNAME(rstcode):
-	bl	1f
-	.long	cpu_reset
-1:	mflr	%r31
-	lwz	%r31,0(%r31)
+	lwz	%r31, TRAP_GENTRAP(0)
+	addi	%r31, %r31, (cpu_reset - generictrap)
 	mtlr	%r31
 	blrl
 CNAME(rstcodeend):
@@ -384,10 +382,8 @@ CNAME(alitrap):
 	mtcr	%r31
 
 	/* Jump to s_trap */
-	bl	1f
-	.long	s_trap
-1:	mflr	%r31
-	lwz	%r31,0(%r31)
+	lwz	%r31, TRAP_GENTRAP(0)
+	addi	%r31, %r31, (s_trap - generictrap)
 	mtlr	%r31
 	blrl
 CNAME(aliend):
@@ -652,10 +648,8 @@ CNAME(dsitrap):
 	mflr	%r28			/* save LR (SP already saved) */
 
 	/* Jump to disitrap */
-	bl	4f
-	.long	disitrap
-4:	mflr	%r1
-	lwz	%r1,0(%r1)
+	lwz	%r1, TRAP_GENTRAP(0)
+	addi	%r1, %r1, (disitrap - generictrap)
 	mtlr	%r1
 	blrl
 CNAME(dsiend):
@@ -929,10 +923,8 @@ CNAME(dblow):
         mflr	%r28					/* save LR */
 
 	/* Jump to dbtrap */
-	bl	2f
-	.long	dbtrap
-2:	mflr	%r1
-	lwz	%r1,0(%r1)
+	lwz	%r1, TRAP_GENTRAP(0)
+	addi	%r1, %r1, (dbtrap - generictrap)
 	mtlr	%r1
 	blrl
 CNAME(dbend):


More information about the svn-src-head mailing list