ccl
ccl copied to clipboard
lisp kernel build failure on FreeBSD 12.1
A user reported the following build error on a FreeBSD 12.1 system:
cc -m64 -g -fuse-ld=bfd -Wl,--export-dynamic -o ../../fx86cl64 pad.o x86-spjump64.o x86-spentry64.o x86-subprims64.o pmcl-kernel.o gc-common.o x86-gc.o bits.o x86-exceptions.o x86-utils.o image.o thread_manager.o lisp-debug.o memory.o unix-calls.o x86-asmutils64.o imports.o lispdcmd.o plprint.o plsym.o xlbt.o x86_print.o -lm -lthr
cc: error: invalid linker name in argument '-fuse-ld=bfd'
*** Error code 1
This is vexing because the solution for #173 was to add the -fuse-ld=bfd
flag. Perhaps the older bfd linker needs to be installed separately?
I am in the middle of upgrading a 12.0-RELEASE system to 12.1-RELEASE, and as part of the upgrade, /usr/bin/ld.bfd
is getting removed.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219717
So, at the moment, we're back to
ld: error: x86-subprims64.o: SHF_MERGE section size must be a multiple of sh_entsize
which is what we saw back in #173.
A question: are all the .stab* directives generated in those assembler files actually doing anything useful? All the other object files seem to have DWARF debug sections (I think) instead.
(The lld error message is misleading: it's checking section size against sh_entsize for all sections, not just SHF_MERGE sections. The .stab sections of most of the assembler-generated .o files have sizes not multiples of sh_entsize.)
That’s my main question too; no longer generating .stab*
directives would enable the macOS build to switch off the archaic assembler as well.
Oh, and as I just mentioned on IRC, adding -Wl,-O0 disables merging in lld which avoids the issue entirely, so that may be an acceptable workaround.
Can someone upload an lld reproduce file somewhere?
Either LLD_REPRODUCE=/tmp/rep.tar
or -Wl,--reproduce=/tmp/rep.tar
The ELF specification says:
sh_entsize: Some sections hold a table of fixed-size entries, such as a symbol table. For such a section, this member gives the size in bytes of each entry. The member contains 0 if the section does not hold a table of fixed-size entries.
So it is wrong if sh_size%sh_entsize!=0
@MaskRay I uploaded https://ccl.clozure.com/~rme/rep.tar.gz
It can be reproduced by just using as --gstabs
on a trivial assembler file and trying to link it, so it's not caused by anything specifically wrong here.
LLD bug report is https://bugs.llvm.org/show_bug.cgi?id=45370 which contains a trivial reproducer.
FreeBSD 12.4 (at least) includes the fix for this. In the CCL 1.12.2 release, I've removed the -Wl,-O0
workaround (and stopped generating .stabs
as well).