Page MenuHomeFreeBSD

Use LDFLAGS rather than CFLAGS when linking.

Authored by brooks on Mar 3 2017, 11:41 PM.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

brooks updated this revision to Diff 25960.Mar 3 2017, 11:41 PM
brooks retitled this revision from to Use LDFLAGS rather than CFLAGS when linking..
brooks updated this object.
brooks edited the test plan for this revision. (Show Details)
brooks added reviewers: kan, emaste.

I'm using this in CheriBSD where we're adding -fuse-ld=lld to LDFLAGS in some cases.

kan edited edge metadata.Mar 4 2017, 1:10 AM

Does LDFLAGS contain -m32/64 -mabi and -EB/-EL as appropriate on MIPS? If not, this change will definitely break things.

brooks added a comment.Mar 4 2017, 1:46 AM

It defiantly contained -EB. I'm having a hard time figuring out if it contains -m32/64 -mabi because they aren't set be default at it appears that lib32buildenv was nuked making it hard to check that case. I do see that uses only LDFLAGS.

brooks added a reviewer: jhb.Mar 4 2017, 1:47 AM

Adding John since he's mucked with CPU flags and libcompat lately.

kan added a comment.Mar 4 2017, 3:01 AM

Quick way to find out is to build mipselhf world using external GCC. It basically gets all things wrong re:default endianness and softfloat.

jhb edited edge metadata.Mar 4 2017, 6:46 PM

I have added -mabi=XX to both CFLAGS and LDFLAGS in my mips_xbuild branch (and should push that into head soon). That is needed for external GCC to do sane things with "unusual" ABIs like n32 and el. However, using LDFLAGS when linking instead of CFLAGS seems sensible.

kan accepted this revision.Mar 4 2017, 8:22 PM
kan edited edge metadata.

This work

This revision is now accepted and ready to land.Mar 4 2017, 8:22 PM
This revision was automatically updated to reflect the committed changes.