Bug 215821 for TARGET_ARCH=powerpc64: bootstrapped ld produces a "shared object" when given a -pie option; junk kernel produced crashes

Justin Hibbits jrh29 at alumni.cwru.edu
Fri Jan 6 15:19:36 UTC 2017


On Fri, Jan 6, 2017 at 3:04 AM, Mark Millard <markmi at dsl-only.net> wrote:
> I have submitted a FreeBSD bugzilla entry:
>
> Bug 215821 - head -r311147's bootstrapped ld for TARGET_ARCH=powerpc64 produces kernel.full as a "shared object" for -pie instead of as a "executable": booting the produced kernel crashes
>
> In essence what the .meta file for kernel.full shows as:
>
> CMD @ld -Bdynamic -T /usr/src/sys/conf/ldscript.powerpc64 -pie --no-warn-mismatch  --warn-common --export-dynamic --dynamic-linker /red/herring  -o kernel.full -X locore.o . . .
>
> (note the -pie) ends up producing:
>
> ELF 64-bit MSB shared object, 64-bit PowerPC or cisco 7500, version 1 (FreeBSD), dynamically linked, interpreter /red/herring, not stripped
>
> instead of what it should have produced:
>
> ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (FreeBSD), dynamically linked, interpreter /red/herring, not stripped
>
> The differences in content leads to the powerpc64 crashing at the start of the produced kernel.
>
> This means needing to use devel/binutils and/or devel/powerpc64-binutils instead (at least for ld).
>
> ===
> Mark Millard
> markmi at dsl-only.net

Hi Mark,

Nathan made a change 2 years ago to build the kernel as a shared
object, so that it can be relocatable.  Looking at my kernel.full
(base gcc build):

world/zhabar/home/chmeee/freebsd/pristine/sys/ZHABAR/kernel.full: ELF
64-bit MSB shared object, 64-bit PowerPC or cisco 7500, version 1
(FreeBSD), dynamically linked, interpreter /red/herring, not stripped

- Justin


More information about the freebsd-ppc mailing list