Shorter version: -m elf32ppc_fbsd (and elf_i386_fbsd ?) vs. -Wl, -m, elf32ppc_fbsd problems (11.0-CURRENT and 10.1-STABLE)
Mark Millard
markmi at dsl-only.net
Fri Apr 10 03:46:52 UTC 2015
I had written:
> I now see one place where "-Wl,-m,elf32ppc_fbsd" type of notation in LDFLAGS would not be handled if it ended up involved:
>
> share/mk/sys.mk:_LDFLAGS = ${LDFLAGS:S/-Wl,//g} # strip -Wl, for LD
>
> This notation does not deal with turning the extra comma back into a space.
So I’ve restarted the powerpc64 FreeBSD hosted tests, now based on the notation
-Wl,-m -Wl,elf32ppc_fbsd
which sys.mk’s _LDFLAGS assignment should handle okay.
One test is building 11.0-CURRENT -r281236 via powerpc64-xtoolchain-gcc and the other is building 10.1-STABLE -r281235 via the system/normal gcc 4.2.1.
As my builds take considerable time if they actually complete, it will be a while before I can try any other variations, such as trying a gcc 4.2.1 cross-build for powerpc.
Unfortunately for the purpose at hand: I’m not set up to test any tier 1 FreeBSD environments at this time. So, for example, I can not report observations for amd64 building elf_i386_fbsd materials. My tests may be useful but are not sufficient of themselves to justify edits that anyone worries might damage tier 1 build-ability.
The places I found with notation to adjust if in general the updated notation works are:
> LDFLAGS+= -m elf32ppc_fbsd
> /usr/src/sys/boot/ofw/Makefile.inc
> LDFLAGS+= -m elf32ppc_fbsd
> /usr/src/sys/boot/uboot/Makefile.inc
> LDFLAGS+= -m elf32ppc_fbsd
> /usr/src/sys/boot/powerpc/Makefile.inc
and the tier 1 case using elf_i386_fbsd:
> LD_FLAGS+= -m elf_i386_fbsd
> /usr/src/sys/boot/i386/Makefile.inc
===
Mark Millard
markmi at dsl-only.net
Just for reference…
On 2015-Apr-9, at 07:35 PM, Warner Losh <imp at bsdimp.com> wrote:
>
>> On Apr 9, 2015, at 7:56 PM, Mark Millard <markmi at dsl-only.net> wrote:
>>
>> From share/mk/bsd.README :
>>
>> LDFLAGS Additional loader flags. Passed to the loader via CC,
>> since that's used to link programs as well, so loader
>> specific flags need to be prefixed with -Wl, to work.
>>
>> But the following 3 powerpc (non-64) examples do not use the -Wl, notation:
>>
>>> LDFLAGS+= -m elf32ppc_fbsd
>>> /usr/src/sys/boot/ofw/Makefile.inc
>>
>>
>>> LDFLAGS+= -m elf32ppc_fbsd
>>> /usr/src/sys/boot/uboot/Makefile.inc
>>
>>
>>> LDFLAGS+= -m elf32ppc_fbsd
>>> /usr/src/sys/boot/powerpc/Makefile.inc
>>
>> In fact I get errors such as (for that last one when using powerpc64-gcc via powerpc64-xtoolchain-gcc, executed on a powerpc64):
>>
>>> powerpc64-portbld-freebsd11.0-gcc: error: elf32ppc_fbsd: No such file or directory
>>> powerpc64-portbld-freebsd11.0-gcc: error: elf32ppc_fbsd: No such file or directory
>>> powerpc64-portbld-freebsd11.0-gcc: error: unrecognized command line option '-m'
>>> powerpc64-portbld-freebsd11.0-gcc: error: unrecognized command line option '-m'
>>>
>>> *** [boot1.elf] Error code 1
>>>
>>> make[6]: stopped in /usr/srcC/sys/boot/powerpc/boot1.chrp
>>> 1 error
>>
>> I do not know if the space between -m and elf... creates a problem for -Wl, use or not. I would guess that
>>
>> -Wl,-m,elf32pcc_fbsd
>>
>> is the proper notation for putting the space through to the ld variant used. But I’m not to the point of testing the behavior of that yet.
>>
>>
>>
>> i386 seems to have a similar example, although I’m not using such a FreeBSD environment.
>>
>>> LD_FLAGS+= -m elf_i386_fbsd
>>> /usr/src/sys/boot/i386/Makefile.inc
>>
>>
>>
>> (This note is shorter in part because figured out more context than I had last time.)
>
> I think much of this is historical accident where the boot Makefiles used to call ld directly, then were converted to call gcc, and gcc allowed the -m notation like this as a historical compatibility.
>
> Do thinks still work if you use -Wl, notation?
>
> Warner
>
I have a powerpc64-xtoolchain-gcc build going now but that will take a while. I’ll also need to try a normal one from a gcc 4.2.1 environment and I’ve not started that yet. And I’m only set up to test powerpc64 and powerpc. The tier 1 consequences (i386 and amd64) are outside my environment.
Also I sent out another note after discovering a potential problem...
> I now see one place where "-Wl,-m,elf32ppc_fbsd" type of notation in LDFLAGS would not be handled if it ended up involved:
>
> share/mk/sys.mk:_LDFLAGS = ${LDFLAGS:S/-Wl,//g} # strip -Wl, for LD
>
> This notation does not deal with turning the extra comma back into a space.
===
Mark Millard
markmi at dsl-only.net
More information about the freebsd-ppc
mailing list