c++ -flto always results in unresolved symbols
Bug #872687 reported by
Tom Vijlbrief
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
binutils |
Fix Released
|
Medium
|
|||
binutils (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Oneiric |
Fix Released
|
High
|
Unassigned |
Bug Description
TEST CASE
=======main.cc =====
int main() {}
===================
c++ -flto main.cc
EXPECTED RESULT:
Builds fine
WHAT HAPPENS:
results in unresolved symbol errors on latest oneiric beta
WORKAROUND
Adding -static is a work around
Changed in binutils: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
Changed in binutils (Ubuntu Oneiric): | |
importance: | Undecided → High |
status: | New → Confirmed |
Changed in binutils: | |
status: | Confirmed → In Progress |
Changed in binutils: | |
status: | In Progress → Fix Released |
description: | updated |
tags: |
added: verification-done removed: verification-needed |
tags: | added: testcase |
To post a comment you must log in.
seen with the 2.22 branch (and the fix for pr13250 applied), works with gold, gcc is 4.6 from the branch.
$ cat foo.cc
int main() {}
$ g++ -B/usr/lib/gold-ld/ -Wl,--as-needed -flto foo.cc
ok
$ $ gcc -Wl,--as-needed -flto foo.cc
ok
$ $ g++ -Wl,--as-needed -flto foo.cc linux-gnu/ libc.so. 6: undefined reference to `_dl_argv@ GLIBC_PRIVATE' linux-gnu/ libc.so. 6: undefined reference to `__libc_ stack_end@ GLIBC_2. 1' linux-gnu/ libc.so. 6: undefined reference to `__libc_ enable_ secure@ GLIBC_PRIVATE' linux-gnu/ libc.so. 6: undefined reference to `_rtld_ global@ GLIBC_PRIVATE' linux-gnu/ libc.so. 6: undefined reference to `___tls_ get_addr@ GLIBC_2. 3' linux-gnu/ libc.so. 6: undefined reference to `_rtld_ global_ ro@GLIBC_ PRIVATE'
/lib/i386-
/lib/i386-
/lib/i386-
/lib/i386-
/lib/i386-
/lib/i386-
collect2: ld returned 1 exit status