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

--- Comment #1 from Chuang Wang <koule2333 at gmail dot com> ---
mycase:

// caller.cpp
#include <iostream>
extern int hack();
int main()
{
    std::cout << hack() << std::endl;
}

// goo.cpp
int hack()
{
    int s = 1;
    for (int i = 1; i < 9999; ++i) {
        s *= i + i;
    }
    return s;
}

// foo.cpp
#include <map>
#include <string>
std::map<double, std::string> double2String;

void update(double f, const std::string& s) {
    double2String[f] = s;
}

std::string query(double f) {
    return double2String.at(f);
}


// build.sh
g++ -O3 -fPIC -c foo.cpp 
g++ -O3 -fPIC -c goo.cpp 
g++ -O3 -fuse-ld=bfd -fPIC --shared -o libxxx.so foo.o goo.o

g++ -O3 -fPIC -c caller.cpp 
g++ -O3 -fuse-ld=bfd -fPIC caller.o libxxx.so -o caller
./caller

g++ -O3 -flto -fPIC -c foo.cpp 
g++ -O3 -flto -fPIC -c goo.cpp 
g++ -O3 -fuse-ld=gold -fPIC --shared -o libxxx.so -Wl,--start-lib foo.o goo.o
-Wl,--end-lib
./caller

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

Reply via email to