https://sourceware.org/bugzilla/show_bug.cgi?id=21479
--- Comment #6 from Sam James <sam at gentoo dot org> --- Thank you! So far, it looks good. I am testing more. A question: when strip has no plugin support (like in 2.44), `strip -R '.gnu.lto_*' -R '.gnu.debuglto_*' -N __gnu_lto_v1 a.o` where a.o is a fat LTO object from -ffat-lto-objects will make a.o a regular object file, as if it wasn't built with LTO. This is useful for distributing because we don't know what compiler or version will be used to link against it later. What's the best way to do this with strip? i.e. a.c: ``` int foo(); int foo() { return 42; } ``` main.c: ``` #include <stdio.h> int foo(); int main() { printf("Got magic number: %d\n", foo()); return 0; } ``` This works: ``` gcc a.c -O2 -flto -ffat-lto-objects -c /usr/x86_64-pc-linux-gnu/binutils-bin/2.44/strip -R '.gnu.lto_*' -R '.gnu.debuglto_*' -N __gnu_lto_v1 a.o clang -O2 -flto -ffat-lto-objects -fuse-ld=mold main.c a.o -o main && ./main ``` This doesn't: ``` gcc a.c -O2 -flto -ffat-lto-objects -c /usr/x86_64-pc-linux-gnu/binutils-bin/9999/strip -R '.gnu.lto_*' -R '.gnu.debuglto_*' -N __gnu_lto_v1 a.o # strip with patch clang -O2 -flto -ffat-lto-objects -fuse-ld=mold main.c a.o -o main && ./main ``` This works (i.e. add --plugin=/dev/null when we want it to be dumb): ``` gcc a.c -O2 -flto -ffat-lto-objects -c ar qv a.a a.o /usr/x86_64-pc-linux-gnu/binutils-bin/9999/strip -R '.gnu.lto_*' -R '.gnu.debuglto_*' -N __gnu_lto_v1 a.a --plugin=/dev/null # strip with patch clang -O2 -flto -ffat-lto-objects -fuse-ld=mold main.c a.a -o main && ./main ``` But that workaround/fix doesn't work for archives: ``` gcc a.c -O2 -flto -ffat-lto-objects -c ar qv a.a a.o /usr/x86_64-pc-linux-gnu/binutils-bin/9999/strip -R '.gnu.lto_*' -R '.gnu.debuglto_*' -N __gnu_lto_v1 a.a --plugin=/dev/null # strip with patch clang -O2 -flto -ffat-lto-objects -fuse-ld=mold main.c a.a -o main && ./main ``` strip is trying to do the right thing, and the LTO plugin claims the whole object, then -R can't do anything. --plugin=/dev/null doesn't help there when we have a archive .a instead of .o. Do we need a special option just for stripping LTO sections (rather than passing them as arbitrary strings)? (I don't need to strip arbitrary sections, just to strip out bytecode for LTO to make archives generic.) -- You are receiving this mail because: You are on the CC list for the bug.