https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089
--- Comment #2 from Dmitry G. Dyachenko <dimhen at gmail dot com> --- gcc invocation can be simplified : -fno-semantic-interposition can be removed. (was needed while creducing original testcase) So, $ g++ -fpreprocessed -O2 -flto -fPIC -DPIC -c -o a.o a.ii $ g++ -fpreprocessed -O2 -flto -fPIC -DPIC -c -o b.o b.ii $ g++ -flto -fPIC -DPIC -shared a.o b.o