Bug 25948 - gold: in --start-group, an undefined symbol in shared object does not fetch a previous archive
Summary: gold: in --start-group, an undefined symbol in shared object does not fetch a...
Status: UNCONFIRMED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.35
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-08 04:46 UTC by Fangrui Song
Modified: 2020-05-08 04:46 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2020-05-08 04:46:47 UTC
as /dev/null -o a.o
echo '.globl foo; .type foo,@function; foo:' > b.s && gcc -c b.s -o b.o && ar rc b.a b.o
echo 'call foo' > c.s && gcc -shared c.s -o c.so

# GNU ld correctly fetches b.a(b.o)
ld.bfd a.o --start-group b.a c.so --end-group -y foo
# ld.bfd: c.so: reference to foo
# ld.bfd: b.a(b.o): definition of foo

# gold incorrectly errors. It should fetch b.a(b.o)
gold a.o --start-group b.a c.so --end-group -y foo
# c.so: reference to foo
# c.so: error: undefined reference to 'foo'