[Bug 258820] Multiple ports fail to build with USE_LTO: libffi.a strip: file format not recognized (propose: disable building static library)

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 22 Nov 2021 15:58:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258820

--- Comment #9 from Ed Maste <emaste@freebsd.org> ---
(In reply to Kubilay Kocak from comment #8)
Your assumption is correct, when built with -flto the object file is LLVM IR
rather than ELF.

$ cc -c -flto foo.o
$ file foo.o
foo.o: LLVM IR bitcode

A .a is just an archive of .o files (along with a symbol table), and isn't part
of the strip issue per se.

A few points here:

- It usually doesn't make a lot of sense to strip .o or .a files.

- Stripping LLVM IR also doesn't make a lot of sense IMO.

- We could probably have ELF Tool Chain strip detect and ignore bitcode files -
make no changes and exit with status 0.

- ELF Tool Chain ar can create a .a archive of LLVM IR .o files, but cannot
parse the symbol tables in the .o files to create the archive symbol table.

- Longer term we will presumably migrate to LLVM's ar, nm, strip etc.
(WITH_LLVM_BINUTILS) as it seems unlikely support will be added to ELF Tool
Chain tools.

Given the above I suggest that in the short term we should just stop trying to
strip libffi.a (and other .a archives in ports), and do nothing else until we
have migrated to LLVM's tools. Having ELF Tool Chain strip ignore bitcode is
probably straightforward, but it's not that useful if we don't also address ar.

-- 
You are receiving this mail because:
You are on the CC list for the bug.