Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jan 2020 16:43:58 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Cc:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
Subject:   Re: 32-bit powerpc kernel builds (head -r356187): old ld (works) vs. devel/binutils@powerpc based (fails to boot): DYNAMIC vs. EXEC_P (powerpc64 lld too)
Message-ID:  <27625540-FBB9-44B9-819E-06671133E7FB@yahoo.com>
In-Reply-To: <B8E255B0-75EB-40C8-84C8-9AAFD1EBDCA4@yahoo.com>
References:  <F5A9F8BE-72EA-41E9-9CDF-8588027D94C8@yahoo.com> <B8E255B0-75EB-40C8-84C8-9AAFD1EBDCA4@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On 2019-Dec-31, at 16:44, Mark Millard <marklmi at yahoo.com> wrote:

> On 2019-Dec-31, at 14:52, Mark Millard <marklmi at yahoo.com> wrote:
>=20
>> My attempt to buildkernel via devel/binutils@powerpc
>> produces a kernel that gets a very early crash.
>>=20
>> Looking at the normal and alternate kernels a little
>> shows. . .
>>=20
>>=20
>>=20
>> Old ld (and such):
>>=20
>> /boot/kernel/kernel:     file format elf32-powerpc-freebsd
>> /boot/kernel/kernel
>> architecture: powerpc:common, flags 0x00000150:
>> HAS_SYMS, DYNAMIC, D_PAGED
>> start address 0x001001e0
>> . . .
>> 00e7a034 l     O *ABS*  00000000 .hidden _DYNAMIC
>>=20
>> Produced via (from kernel.full.meta):
>>=20
>> CMD @ld -m elf32ppc_fbsd -Bdynamic -T =
/usr/src/sys/conf/ldscript.powerpc --secure-plt -pie  --no-warn-mismatch =
--warn-common --export-dynamic  --dynamic-linker /red/herring -X -o =
kernel.full locore.o . . .
>>=20
>>=20
>> devel/binutils@powerpc based:
>>=20
>> /boot/kerbad/kernel:     file format elf32-powerpc-freebsd
>> /boot/kerbad/kernel
>> architecture: powerpc:common, flags 0x00000112:
>> EXEC_P, HAS_SYMS, D_PAGED
>> start address 0x00100200
>>=20
>> 00e7a034 l     O .dynamic       00000000 _DYNAMIC
>>=20
>> Produced via (from kernel.full.meta):
>>=20
>> CMD @/usr/local/powerpc-unknown-freebsd13.0/bin/ld -m elf32ppc_fbsd =
-Bdynamic -T /usr/src/sys/conf/ldscript.powerpc --secure-plt =
--build-id=3Dsha1 -pie  --no-warn-mismatch --warn-common =
--export-dynamic
>> --dynamic-linker /red/herring -X -o kernel.full locore.o . . .
>=20

I see the same sort of thing for powerpc64
kernels, based on system lld and such vs. based
on devel/binutils@powerpc64 .

(The old 2 socket/2-cores-per PowerMac is
rebuilding the 435 ports on head -r356187 .)

> _GLOBAL_OFFSET_TABLE_ has a similar status.
>=20
> In fact, there is a big difference in the two
> context's ABS lists:  devel/binutils@powerpc
> produces a very short list:
>=20
> # readelf -a /boot/kerbad/kernel | grep "\<ABS\>" | more
>     2: 0000000000000070     0 NOTYPE  GLOBAL DEFAULT  ABS dlmisssize
>   569: 0000000000100100     0 NOTYPE  GLOBAL DEFAULT  ABS kernbase
>  5103: 0000000000000020     0 NOTYPE  GLOBAL DEFAULT  ABS =
testppc64size
>  8156: 0000000000000018     0 NOTYPE  GLOBAL DEFAULT  ABS =
restorebridgesize
>  9078: 00000000000000b0     0 NOTYPE  GLOBAL DEFAULT  ABS imisssize
> 12351: 00000000000000f0     0 NOTYPE  GLOBAL DEFAULT  ABS dsmisssize
> 25923: 0000000000000070     0 NOTYPE  GLOBAL DEFAULT  ABS dlmisssize
> 26490: 0000000000100100     0 NOTYPE  GLOBAL DEFAULT  ABS kernbase
> 31024: 0000000000000020     0 NOTYPE  GLOBAL DEFAULT  ABS =
testppc64size
> 34077: 0000000000000018     0 NOTYPE  GLOBAL DEFAULT  ABS =
restorebridgesize
> 34999: 00000000000000b0     0 NOTYPE  GLOBAL DEFAULT  ABS imisssize
> 38272: 00000000000000f0     0 NOTYPE  GLOBAL DEFAULT  ABS dsmisssize
>=20
> but the old ld produces a much longer list:
>=20
> # readelf -a /boot/kernel/kernel | grep "\<ABS\>" | more
>     2: 0000000000000070     0 NOTYPE  GLOBAL DEFAULT  ABS dlmisssize
>   212: 0000000000e793dc     0 NOTYPE  GLOBAL DEFAULT  ABS =
__start_set_gfb_set
>   462: 0000000000e793c8     0 NOTYPE  GLOBAL DEFAULT  ABS =
__start_set_mmu_set
>   569: 0000000000100100     0 NOTYPE  GLOBAL DEFAULT  ABS kernbase
>  1334: 0000000000dd5728     0 NOTYPE  GLOBAL DEFAULT  ABS =
__start_set_sdt_probes_set
>  1395: 0000000000e5e608     0 NOTYPE  GLOBAL DEFAULT  ABS =
__start_set_vnet
>  1765: 0000000001183648     0 NOTYPE  GLOBAL DEFAULT  ABS end
>  1798: 0000000000dd36d0     0 NOTYPE  GLOBAL DEFAULT  ABS =
__stop_set_sysinit_set
>  1857: 0000000000dd4e34     0 NOTYPE  GLOBAL DEFAULT  ABS =
__stop_set_modmetadata_set
. . . (detail dropped) . . .
> 35963: 0000000000dd5674     0 NOTYPE  GLOBAL DEFAULT  ABS =
__stop_set_kbddriver_set
> 35987: 0000000000dd5728     0 NOTYPE  GLOBAL DEFAULT  ABS =
__stop_set_sdt_providers_set
> 36015: 0000000001183648     0 NOTYPE  GLOBAL DEFAULT  ABS _end
> 36625: 0000000000e793d4     0 NOTYPE  GLOBAL DEFAULT  ABS =
__start_set_videodriver_set
> 36828: 0000000000dd7954     0 NOTYPE  GLOBAL DEFAULT  ABS =
__start_set_scterm_set
> 37429: 0000000000e9786c     0 NOTYPE  GLOBAL DEFAULT  ABS _edata
> 37854: 0000000000dd7988     0 NOTYPE  GLOBAL DEFAULT  ABS =
__start_set_vt_drv_set
> 38049: 0000000000dc2240     0 NOTYPE  GLOBAL DEFAULT  ABS =
__stop_set_sysctl_set
> 38270: 00000000000000f0     0 NOTYPE  GLOBAL DEFAULT  ABS dsmisssize
>=20
> So what do the __start_set_* and __stop_set_* symbols
> show up as in /boot/kerbad/kernel generally? PROTECTED
> visibility as a GLOBAL as it turns out:
>=20
> # readelf -a /boot/kerbad/kernel | egrep "__(start|stop)_set_" | more
> 00e83680 002c0701 R_PPC_ADDR32        00000000 =
__stop_set_uart_fdt_class_set + 0
> 00e83684 0021a801 R_PPC_ADDR32        00000000 =
__start_set_uart_fdt_class_set + 0
>   212: 0000000000e793dc     0 NOTYPE  GLOBAL PROTECTED  48 =
__start_set_gfb_set
>   462: 0000000000e793c8     0 NOTYPE  GLOBAL PROTECTED  45 =
__start_set_mmu_set
. . . (detail dropped) . . .
> 35681: 0000000000dd565c     0 NOTYPE  GLOBAL PROTECTED  29 =
__start_set_kdb_dbbe_set
> 35695: 0000000000dd5668     0 NOTYPE  GLOBAL PROTECTED  30 =
__start_set_kbddriver_set
> 35965: 0000000000dd5674     0 NOTYPE  GLOBAL PROTECTED  30 =
__stop_set_kbddriver_set
> 35989: 0000000000dd5728     0 NOTYPE  GLOBAL PROTECTED  33 =
__stop_set_sdt_providers_set
> 36627: 0000000000e793d4     0 NOTYPE  GLOBAL PROTECTED  46 =
__start_set_videodriver_set
> 36830: 0000000000dd7954     0 NOTYPE  GLOBAL PROTECTED  36 =
__start_set_scterm_set
> 37192: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND =
__stop_set_uart_fdt_class_set
> 37856: 0000000000dd7988     0 NOTYPE  GLOBAL PROTECTED  40 =
__start_set_vt_drv_set
> 38051: 0000000000dd2468     0 NOTYPE  GLOBAL PROTECTED  22 =
__stop_set_sysctl_set
>=20
>=20
>=20
> (Note: the "bad" in "/boot/kerbad/" is just a
> reference to the boot failure, a relationship
> of the link results and code handling the loaded
> kernel code. Which style of linker output for the
> kernel is "more correct" for the linker options
> supplied is not part of my claims. I am noting
> the mismatches, however.)
>=20



=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?27625540-FBB9-44B9-819E-06671133E7FB>