Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jun 2019 15:03:55 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Justin Hibbits <jrh29@alumni.cwru.edu>
Cc:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   Re: FreeBSD/powerpc and FreeBSD/powerpcspe toolchain update
Message-ID:  <9C229946-C51B-41BF-9661-F6B6D585903D@yahoo.com>
In-Reply-To: <4B8DE338-8152-42CD-914C-35596FFDA76B@yahoo.com>
References:  <CAHSQbTBjZFb1dPk2FN=438i0FVtAKHYy-y22L%2BHFEDrTmd-9Aw@mail.gmail.com> <CE47F595-68EF-43A2-877B-61C1981AF9E7@yahoo.com> <20190627145312.5abd82e7@titan.knownspace> <4B8DE338-8152-42CD-914C-35596FFDA76B@yahoo.com>

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


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:
>=20
>> On Thu, 27 Jun 2019 12:03:05 -0700
>> Mark Millard <marklmi@yahoo.com> wrote:
>>=20
>>> On 2019-Jun-24, at 19:40, Justin Hibbits <jrh29@alumni.cwru.edu>
>>> wrote:
>>>=20
>>>> 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=3D" on the 'make buildworld'
>>>> command line.
>>>>=20
>>>> 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+=3D -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. =20=

>>>=20
>>> 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. )
>>>=20
>>> --- 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
>>>=20
>>=20
>> Hi Mark,
>>=20
>> 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.
>=20
> Sure. readelf shows for agp.kld at 0x37a4 :
>=20
> 000037a4 00004512 R_PPC_PLTREL24      00000000 agp_find_caps + 0
>=20
> and also shows for agp_find_caps:
>=20
>    69: 0000000000000000   172 FUNC    LOCAL  DEFAULT    1 =
agp_find_caps
>=20
> (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/GEN=
ERICvtsc-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/GEN=
ERICvtsc-NODBG/modules/usr/src/sys/modules/agp
TARGET agp.kld
-- command output --

-- filemon acquired metadata --
. . .


=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?9C229946-C51B-41BF-9661-F6B6D585903D>