FreeBSD/powerpc and FreeBSD/powerpcspe toolchain update
Mark Millard
marklmi at yahoo.com
Thu Jun 27 22:24:18 UTC 2019
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. 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