mirror of
https://github.com/rui314/mold.git
synced 2024-12-29 11:24:36 +03:00
wip
This commit is contained in:
parent
f9ecf89b16
commit
1d90a5ad5c
@ -309,7 +309,9 @@ static std::vector<u64> create_dynamic_section() {
|
||||
for (SharedFile *file : out::dsos)
|
||||
define(DT_NEEDED, out::dynstr->find_string(file->soname));
|
||||
|
||||
define(DT_RUNPATH, out::dynstr->find_string(config.rpaths));
|
||||
if (!config.rpaths.empty())
|
||||
define(DT_RUNPATH, out::dynstr->find_string(config.rpaths));
|
||||
|
||||
define(DT_RELA, out::reldyn->shdr.sh_addr);
|
||||
define(DT_RELASZ, out::reldyn->shdr.sh_size);
|
||||
define(DT_RELAENT, sizeof(ElfRela));
|
||||
|
@ -7,14 +7,28 @@ mkdir -p $t
|
||||
cat <<EOF | clang -fPIC -c -o $t/a.o -x assembler -
|
||||
.globl fn1, fn2
|
||||
fn1:
|
||||
call fn2
|
||||
jmp fn2
|
||||
EOF
|
||||
|
||||
clang -shared -fuse-ld=`pwd`/../mold -o $t/b.so $t/a.o
|
||||
clang -shared -fuse-ld=`pwd`/../mold -o $t/b.so $t/a.o
|
||||
|
||||
readelf --dyn-syms $t/b.so > $t/log
|
||||
|
||||
grep -q '0000000000000000 0 NOTYPE GLOBAL DEFAULT UND fn2' $t/log
|
||||
grep -q '000000000000111c 0 NOTYPE GLOBAL DEFAULT 16 fn1' $t/log
|
||||
|
||||
cat <<EOF | clang -fPIC -c -o $t/c.o -xc -
|
||||
int fn1();
|
||||
|
||||
int fn2() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
int main() {
|
||||
return fn1();
|
||||
}
|
||||
EOF
|
||||
|
||||
clang -fuse-ld=`pwd`/../mold -o $t/exe $t/c.o $t/b.so
|
||||
|
||||
echo OK
|
||||
|
Loading…
Reference in New Issue
Block a user