(In reply to Martin Li������ka from comment #11) > (In reply to Richard Biener from comment #10) > > So to clarify - when strip strips a section from ELF it also needs to remove > > any symbols pointing to it since else they might end up pointing into wrong > > sections or to sections that do not exist (out of bound section index) or to > > places outside of the (invalid) section. > > > > eu_strip gets this "right" (with limited testing of a simple exec compiled > > with -flto and stripped with eu-strip --strip-debug), strip --strip-debug > > as well (binutils 2.35.1). > > How do you create the separate debug info ELF file? Note that the > problematic symbol is in the separate binary: > > $ gcc foo.c -O2 -g -flto -shared -o libfoo.so > $ objcopy --only-keep-debug libfoo.so debug.so > $ readelf -s --wide debug.so | grep foo.c > 60: 0000000000000067 0 NOTYPE LOCAL DEFAULT 25 foo.c.cf7807ca I don't - I checked that strip --strip-debug does the correct thing. So there must be code to handle symbols refering to the debug. Because objcopy --only-keep-debug keeps the source intact. You need an additional step to strip libfoo.so from its debug info and that's where things go wrong it seems. > > > > So sth is bogus in the course of events performing the stripping?