FreeBSD/powerpc and FreeBSD/powerpcspe toolchain update
Mark Millard
marklmi at yahoo.com
Thu Jun 27 23:20:02 UTC 2019
[I used src.conf.powerpc-clang-bootstrap.amd64-host which uses
WITHOUT_LLD_BOOTSTRAP= and WITH_BINUTILS_BOOTSTRAP= and so
LLD was not in use.]
On 2019-Jun-27, at 15:03, Mark Millard <marklmi at yahoo.com> wrote:
>
>
> On 2019-Jun-27, at 14:53, Mark Millard <marklmi at yahoo.com> wrote:
>
>
>
>> On 2019-Jun-27, at 12:53, Justin Hibbits <jrh29 at alumni.cwru.edu> wrote:
>>
>>> On Thu, 27 Jun 2019 12:03:05 -0700
>>> Mark Millard <marklmi at yahoo.com> wrote:
>>>
>>>> On 2019-Jun-24, at 19:40, Justin Hibbits <jrh29 at alumni.cwru.edu>
>>>> wrote:
>>>>
>>>>> As of r349351 32-bit powerpc toolchains need to be rebuilt as part
>>>>> of buildworld, in order to take advantage of the new Secure
>>>>> Procedure Linkage Table (Secure-PLT) format. This can be done by
>>>>> passing "WITHOUT_SYSTEM_TOOLCHAIN=" on the 'make buildworld'
>>>>> command line.
>>>>>
>>>>> Cross-building should work fine with no changes, as that already
>>>>> builds a new toolchain. If building with an external toolchain,
>>>>> such as gcc8, add 'CFLAGS+= -msecure-plt' to /etc/src.conf to
>>>>> ensure the new PLT is used, otherwise it will default to BSS-PLT,
>>>>> which is fully compatible, but not as secure. There is breakage
>>>>> intended at all, so please let me know if there are any problems.
>>>>
>>>> My attempt to amd64->powerpc (32-bit) cross build from/to head
>>>> -r349444 via system clang and lld got the following. This may not be
>>>> a recent change.
Gack: Looking at the src.conf.powerpc-clang-bootstrap.amd64-host
text I'd originally included but has been dropped later in this
exchange, there is:
WITHOUT_SYSTEM_LINKER=
. . .
WITHOUT_LLD_BOOTSTRAP=
WITH_BINUTILS_BOOTSTRAP=
WITH_ELFTOOLCHAIN_BOOTSTRAP=
So lld was not in use as I intended: wrong src.conf.* file.
I did not end up testing what I intended to test.
So this is actually about ld from WITH_BINUTILS_BOOTSTRAP :
# /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/tmp/usr/bin/ld -v
GNU ld 2.17.50 [FreeBSD] 2007-07-03
Sorry for the misdirection.
>>>> It has been a long time since I tried lld, instead
>>>> using devel/powerpc64-binutils. ( devel/powerpc64-binutils now fails
>>>> where it used to work, but I sent a separate note out about that. )
>>>>
>>>> --- agp.ko.full ---
>>>> ld: agp.kld(.text+0x37a4): R_PPC_PLTREL24 reloc against local symbol
>>>> agp.kld: could not read symbols: Bad value
>>>> *** [agp.ko.full] Error code 1
>>>>
>>>
>>> Hi Mark,
>>>
>>> Can you determine what symbol has that relocation? I don't see that
>>> error when building natively, or cross-building with base toolchain, so
>>> there's very likely a change in binutils between 2.17 and now that's
>>> leading to this failure.
>>
>> Sure. readelf shows for agp.kld at 0x37a4 :
>>
>> 000037a4 00004512 R_PPC_PLTREL24 00000000 agp_find_caps + 0
>>
>> and also shows for agp_find_caps:
>>
>> 69: 0000000000000000 172 FUNC LOCAL DEFAULT 1 agp_find_caps
>>
>> (Note that I build with debug symbols., even for non-debug builds.)
>
> FYI for how agp.kld was produced:
>
> # Meta data file /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/agp/agp.kld.meta
> CMD ld -m elf32ppc_fbsd --secure-plt -d -warn-common -r -d -o agp.kld agp.o agp_if.o agp_apple.o
> CMD ctfmerge -L VERSION -g -o agp.kld agp.o agp_if.o agp_apple.o
> CMD echo -n "agp_find_device
> agp_state
> agp_acquire
> agp_release
> agp_enable
> agp_alloc_memory
> agp_free_memory
> agp_bind_memory
> agp_unbind_memory
> agp_memory_info
> " > export_syms
> CMD awk -f /usr/src/sys/conf/kmod_syms.awk agp.kld export_syms | xargs -J% objcopy % agp.kld
> CWD /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/agp
> TARGET agp.kld
> -- command output --
>
> -- filemon acquired metadata --
> . . .
===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)
More information about the freebsd-ppc
mailing list