https://sourceware.org/bugzilla/show_bug.cgi?id=17704
Bug ID: 17704 Summary: icf doesn't respect section alignment Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: gold Assignee: ccoutant at google dot com Reporter: rafael.espindola at gmail dot com CC: ian at airs dot com Created attachment 8008 --> https://sourceware.org/bugzilla/attachment.cgi?id=8008&action=edit testcase With the attached testcase, running gcc -c t1.s ld -o foo t1.o ./foo echo $? ld -o foo t1.o --icf=safe ./foo echo $? Will print 0 1 The problem is that icf is merging foo and bar but not enforcing the stricter alignment requirements of bar. While this reduced testcase is assembly, the original was c++. The check of the least significant bit of a function pointer comes from how member functions are implemented: * For non virtual functions, a plain pointer is passed. * For virtual functions it is 1 + the vtable offset To ensure that this works, the compiler has to align member functions, but has no such requirement for regular functions. For example, given struct S { void f() { } }; inline void g() {} void f(S *x) { g(); x->f(); } gcc will align f but not g. It is possible for a member function to codegen to the same bits as a non-member function, which is how this bug was found. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils