Page MenuHomeFreeBSD

stand: fix build with xtoolchain-llvm90

Authored by kevans on Aug 16 2019, 1:45 PM.



ufsread.c grows a dependency on __ashldi3 with llvm90. This exposes itself primarily in gptboot and i386/boot2.

For gptboot, just start pulling in ashldi3.c ashrdi3.c lshrdi3.c into libsa for all archs as the number of archs requiring one or more of them keeps growing. qdivrem.c and quad.h can be trivially kicked out of libsa if we start pulling these from compiler-rt as qdivrem was only used to implement umoddi3, divdi3, moddi3 (also in qdivrem.c).

For boot2, grab ashldi3.c out of compiler-rt as well rather than trying to link against libsa (for now). -Wno-missing-prototypes is necessary to compile ashldi3.c standalone.

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

kevans created this revision.Aug 16 2019, 1:45 PM
imp added inline comments.Aug 16 2019, 2:00 PM
83 ↗(On Diff #60891)

in the past when we've grown these dependencies, it's blow the size limits out of the water so we've done other things to work around them. How much does this add to boot2? And what happens with gcc (either in-tree or out-of-tree) or old-clang when this is brought in? Listing it as a .o means it's always included in the binary output adding too the size.

31 ↗(On Diff #60891)

this whole chunk is orthogonal.

But same questions about size. how much does this affect the size? For a .a it's less of a big deal to include too much because the loader won't pull in .o's from the .a it doesn't need.

In either case, I'd do this change separately.

kevans added inline comments.Aug 16 2019, 2:11 PM
83 ↗(On Diff #60891)

Old clang output w/ ashldi3:

-rw-r--r--  1 root  wheel   3088 Aug 16 08:29 ashldi3.o
-rwxr-xr-x  1 root  wheel  38216 Aug 16 09:07 boot2.out


-rwxr-xr-x  1 root  wheel  37068 Aug 16 09:09 boot2.out
31 ↗(On Diff #60891)

"kind of" orthogonal... there's conflicts between filenames in lib/libc/quad and compiler-rt; the former have qdivrem dependencies, the latter don't. We need to make sure we don't accidentally get lib/libc/quad versions.

imp added inline comments.Aug 16 2019, 2:14 PM
83 ↗(On Diff #60891)

boot2 has to fit in 7.5k... 38k is way beyond that... but there's headers and symbols there.

So can you give 'size' output?

31 ↗(On Diff #60891)

We can make this change without the change to boot2, and it is applicable to today's compilers.

kevans added inline comments.Aug 16 2019, 2:32 PM
83 ↗(On Diff #60891)

Whoops, sorry.


text   data    bss     dec      hex   filename
5197     12   5273   10482   0x28f2   /usr/obj/usr/home/kevans/dev/base/head/amd64.amd64/stand/i386/boot2/boot2.out


text   data    bss     dec      hex   filename
5197     12   5273   10482   0x28f2   /usr/obj/usr/home/kevans/dev/base/head/amd64.amd64/stand/i386/boot2/boot2.out
kevans updated this revision to Diff 60894.Aug 16 2019, 3:02 PM
kevans edited the summary of this revision. (Show Details)
imp accepted this revision.Aug 16 2019, 4:03 PM

looks great to me.

84 ↗(On Diff #60894)

that reminds me... this makefile needs to be rototilled extensively... but that's for another day.

This revision is now accepted and ready to land.Aug 16 2019, 4:03 PM
This revision was automatically updated to reflect the committed changes.