www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17515] New: ld.gold identical comdat folding triggers an

https://issues.dlang.org/show_bug.cgi?id=17515

          Issue ID: 17515
           Summary: ld.gold identical comdat folding triggers an assertion
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

ld -v
cat > bug.d << CODE
import std.stdio;
void main() { writeln("Hello"); }
CODE
dmd bug.d -L--icf=safe
----
/usr/bin/ld: internal error in get_section_contents, at icf.cc:504

Fails at
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gold/icf.cc;h=a49ce2e960ffb6ac9764830f11145d045abba216#l504
for .text. sections because entsize == 0.

Guess this needs something similar to -ffunction-sections with each function
being in it's own section and entsize it's size. At least
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gold/icf.cc;h=a49ce2e960ffb6ac9764830f11145d045abba216#l509
hints towards that.

Not sure why dmd's .text sections take the `if ((secn_flags &
elfcpp::SHF_STRINGS) != 0)` branch though.

--
Jun 16