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
This commit is contained in:
bdragon 2019-11-14 04:34:17 +00:00
parent 75e58233f7
commit 49806b9c2c
3 changed files with 20 additions and 24 deletions

View File

@ -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. */

View File

@ -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. */

View File

@ -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):