git: 3896a6cc0a8e - main - ldscript.powerpc*: Only put .dynamic in PT_DYNAMIC
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 26 Jan 2024 00:19:13 UTC
The branch main has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=3896a6cc0a8e774f33e6381ecc73be6e51dc6a53
commit 3896a6cc0a8e774f33e6381ecc73be6e51dc6a53
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-01-26 00:19:02 +0000
Commit: Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2024-01-26 00:19:02 +0000
ldscript.powerpc*: Only put .dynamic in PT_DYNAMIC
Currently there are a few output sections left as implicitly using
:kernel :dynamic before :kernel on its own is used again, which means
they end up in both the PT_LOAD and the PT_DYNAMIC segments, an unusual
situation which the new libelf-based kldxref initially treated as
invalid. Thus, hoist the :kernel to the very next section to ensure only
.dynamic is in PT_DYNAMIC, as is more normal.
Whilst here, sync ldscript.powerpc64le with ldscript.powerpc64 to pick
up various fixes that were presumably made between the start of the
powerpc64le port and it being committed and got missed.
Reviewed by: jhibbits, jhb
Differential Revision: https://reviews.freebsd.org/D43066
---
sys/conf/ldscript.powerpc | 4 ++--
sys/conf/ldscript.powerpc64 | 4 ++--
sys/conf/ldscript.powerpc64le | 17 +++++++++--------
sys/conf/ldscript.powerpcspe | 4 ++--
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/sys/conf/ldscript.powerpc b/sys/conf/ldscript.powerpc
index 2bfc02768a22..c08123e4eaba 100644
--- a/sys/conf/ldscript.powerpc
+++ b/sys/conf/ldscript.powerpc
@@ -86,7 +86,7 @@ SECTIONS
get relocated with -mrelocatable. Also put in the .fixup pointers.
The current compiler no longer needs this, but keep it around for 2.7.2 */
PROVIDE (_GOT2_START_ = .);
- .got2 : { *(.got2) }
+ .got2 : { *(.got2) } :kernel
PROVIDE (__CTOR_LIST__ = .);
.ctors : { *(.ctors) }
PROVIDE (__CTOR_END__ = .);
@@ -100,7 +100,7 @@ SECTIONS
/* 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. */
- .sdata : { *(.sdata) } :kernel
+ .sdata : { *(.sdata) }
_edata = .;
PROVIDE (edata = .);
.sbss :
diff --git a/sys/conf/ldscript.powerpc64 b/sys/conf/ldscript.powerpc64
index f436a3bc0f64..df279576193f 100644
--- a/sys/conf/ldscript.powerpc64
+++ b/sys/conf/ldscript.powerpc64
@@ -111,7 +111,7 @@ SECTIONS
get relocated with -mrelocatable. Also put in the .fixup pointers.
The current compiler no longer needs this, but keep it around for 2.7.2 */
PROVIDE (_GOT2_START_ = .);
- .got2 : { *(.got2) }
+ .got2 : { *(.got2) } :kernel
PROVIDE (__CTOR_LIST__ = .);
.ctors : { *(.ctors) }
PROVIDE (__CTOR_END__ = .);
@@ -125,7 +125,7 @@ SECTIONS
/* 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. */
- .sdata : { *(.sdata) } :kernel
+ .sdata : { *(.sdata) }
_edata = .;
PROVIDE (edata = .);
.sbss :
diff --git a/sys/conf/ldscript.powerpc64le b/sys/conf/ldscript.powerpc64le
index bd883853711a..3fd80d3130fb 100644
--- a/sys/conf/ldscript.powerpc64le
+++ b/sys/conf/ldscript.powerpc64le
@@ -7,15 +7,15 @@ SEARCH_DIR(/usr/lib);
PROVIDE (__stack = 0);
PHDRS
{
- text PT_LOAD ;
- dynamic PT_DYNAMIC ;
+ kernel PT_LOAD;
+ dynamic PT_DYNAMIC;
}
SECTIONS
{
/* Low-address wrapper for bootloaders (kexec/kboot) that can't parse ELF */
. = kernbase - 0x100;
- .kboot : { *(.text.kboot) } :text
+ .kboot : { *(.text.kboot) } :kernel
/* Read-only sections, merged into text segment: */
. = kernbase;
@@ -36,9 +36,6 @@ SECTIONS
/* Do not emit PT_INTERP section, which confuses some loaders (kexec-lite) */
/DISCARD/ : { *(.interp) }
- /* Also delete notes */
- /DISCARD/ : { *(.note.*) }
-
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
@@ -50,6 +47,10 @@ SECTIONS
*(.note.gnu.build-id)
PROVIDE (__build_id_end = .);
}
+
+ /* Do not emit any additional notes. */
+ /DISCARD/ : { *(.note.*) }
+
.rela.text :
{ *(.rela.text) *(.rela.gnu.linkonce.t*) }
.rela.data :
@@ -105,12 +106,12 @@ SECTIONS
.got : ALIGN(8) { __tocbase = .; *(.got) }
.toc : ALIGN(8) { *(.toc) }
- .dynamic : { *(.dynamic) } :text :dynamic
+ .dynamic : { *(.dynamic) } :kernel :dynamic
/* Put .ctors and .dtors next to the .got2 section, so that the pointers
get relocated with -mrelocatable. Also put in the .fixup pointers.
The current compiler no longer needs this, but keep it around for 2.7.2 */
PROVIDE (_GOT2_START_ = .);
- .got2 : { *(.got2) }
+ .got2 : { *(.got2) } :kernel
PROVIDE (__CTOR_LIST__ = .);
.ctors : { *(.ctors) }
PROVIDE (__CTOR_END__ = .);
diff --git a/sys/conf/ldscript.powerpcspe b/sys/conf/ldscript.powerpcspe
index 38209f6516c8..7d5b54a655a6 100644
--- a/sys/conf/ldscript.powerpcspe
+++ b/sys/conf/ldscript.powerpcspe
@@ -87,7 +87,7 @@ SECTIONS
get relocated with -mrelocatable. Also put in the .fixup pointers.
The current compiler no longer needs this, but keep it around for 2.7.2 */
PROVIDE (_GOT2_START_ = .);
- .got2 : { *(.got2) }
+ .got2 : { *(.got2) } :kernel
PROVIDE (__CTOR_LIST__ = .);
.ctors : { *(.ctors) }
PROVIDE (__CTOR_END__ = .);
@@ -101,7 +101,7 @@ SECTIONS
/* 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. */
- .sdata : { *(.sdata) } :kernel
+ .sdata : { *(.sdata) }
_edata = .;
PROVIDE (edata = .);
.sbss :