(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 > > So sth is bogus in the course of events performing the stripping?