bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/22820] New: ICF mismerges two very similar functions


From: steinar+binutils at gunderson dot no
Subject: [Bug gold/22820] New: ICF mismerges two very similar functions
Date: Thu, 08 Feb 2018 17:29:09 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=22820

            Bug ID: 22820
           Summary: ICF mismerges two very similar functions
           Product: binutils
           Version: 2.30
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: steinar+binutils at gunderson dot no
                CC: ian at airs dot com
  Target Milestone: ---

Hi,

We had a fairly bad data dictionary corruption bug in MySQL, which we
eventually traced down to gold mistakenly ICF-ing two functions that are
actually different. My understanding of the problem is that the two functions
are _bytewise_ identical, but since they refer to different constants using
%rip-relative addressing, they still would execute differently, and thus should
not be merged.

Here's a test case (compiled with GCC 7.3):

atum17:~/reduce5> cat dictionary_impl.cc
#include <string>

int func(std::string);

int get_actual_P_S_version() {
  return func("PS_VERSION");
}
int get_actual_I_S_version() {
  return func("IS_VERSION");
} 
atum17:~/reduce5> g++ -O2 -fPIC -ffunction-sections -fdata-sections -o
dictionary_impl.o -c dictionary_impl.cc
atum17:~/reduce5> g++ -fuse-ld=gold -Wl,--icf=safe -shared -o
dictionary_impl.so dictionary_impl.o
atum17:~/reduce5> nm --demangle dictionary_impl.so | grep get_actual

0000000000000a50 T get_actual_I_S_version()
0000000000000a50 T get_actual_P_S_version()

So the two functions have received the same address in the binary, and thus
were incorrectly merged.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]