-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Milestone
Description
Currently, we incorrectly prepend sysroot to inputs specified in INPUT / GROUP linker script commands.
Reproducible example:
#!/usr/bin/env bash
mkdir -p A/lib64
mkdir -p A/script
cat >1.c <<\EOF
int foo() { return 1; }
EOF
cat >script.t <<\EOF
GROUP(/lib64/lib1.so)
EOF
cat >main.c <<\EOF
int main() { return 0; }
EOF
clang -o lib1.so -target x86_64-unknown-elf 1.c -shared -fPIC
clang -o main.o -target x86_64-unknown-elf main.c -c
mv lib1.so A/lib64/lib1.so
ld.eld --sysroot=A -T script.t main.o
ld.lld --sysroot=A -T script.t main.o
ld.bfd --sysroot=A -T script.t main.o lld and bfd errors out whereas eld incorrectly finds the lib1.so file.
Another example:
#!/usr/bin/env bash
mkdir -p A/lib64
mkdir -p A/script
cat >1.c <<\EOF
int foo() { return 1; }
EOF
cat >script.t <<EOF
GROUP($(pwd)/A/lib64/lib1.so)
EOF
cat >main.c <<\EOF
int main() { return 0; }
EOF
clang -o lib1.so -target x86_64-unknown-elf 1.c -shared -fPIC
clang -o main.o -target x86_64-unknown-elf main.c -c
mv lib1.so A/lib64/lib1.so
ld.eld --sysroot=A -T script.t main.o
ld.lld --sysroot=A -T script.t main.o
ld.bfd --sysroot=A -T script.t main.o lld and bfd are correctly able to find lib1.so but eld canont find the lib1.so file.
Reactions are currently unavailable