On Mon, 28 Sep 2020 17:35:26 +0200, Jakub Jelinek wrote:
So, was this compiled by GCC or clang?
Fedora Koji package:
GNU GIMPLE 10.2.1 20200916 (Red Hat 10.2.1-4) -m64 -mtune=generic -march=x86-64 -g -g -g
-O2 -O2 -O2 -O2 -fno-openmp -fno-openacc -fcf-protection=none -ffat-lto-objects
-fexceptions -fstack-protector-strong -fasynchronous-unwind-tables
-fstack-clash-protection -fPIC -ffunction-sections -fdata-sections -fltrans
A way out of this could be either to use comdat .debug_info etc.
(but that would result in quite large increase of *.o file sizes), or let
the linker or a tool like DWZ discard or simplify such DIEs.
I don't see how could you see at compile time that the linker will not
choose the particular copy.
Another option is to use clang which should have such optimization implemented