mirror of
https://github.com/rui314/mold.git
synced 2024-09-21 09:57:18 +03:00
wip
This commit is contained in:
parent
4dc0918a34
commit
b7791b2a03
@ -25,16 +25,7 @@ main:
|
||||
.string "foo world\n"
|
||||
EOF
|
||||
|
||||
../mold -static -o $t/exe /usr/lib/x86_64-linux-gnu/crt1.o \
|
||||
/usr/lib/x86_64-linux-gnu/crti.o \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginT.o \
|
||||
$t/a.o \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/9/libgcc_eh.a \
|
||||
/usr/lib/x86_64-linux-gnu/libc.a \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/9/crtend.o \
|
||||
/usr/lib/x86_64-linux-gnu/crtn.o
|
||||
|
||||
clang -fuse-ld=`pwd`/../mold -static -o $t/exe $t/a.o
|
||||
$t/exe | grep -q 'Hello world'
|
||||
|
||||
echo OK
|
||||
|
40
test/plt.sh
40
test/plt.sh
@ -20,43 +20,11 @@ msg:
|
||||
.string "Hello world\n"
|
||||
EOF
|
||||
|
||||
../mold -o $t/exe /usr/lib/x86_64-linux-gnu/crt1.o \
|
||||
/usr/lib/x86_64-linux-gnu/crti.o \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/9/crtbegin.o \
|
||||
$t/a.o \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/9/crtend.o \
|
||||
/usr/lib/x86_64-linux-gnu/crtn.o \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a \
|
||||
/usr/lib/x86_64-linux-gnu/libgcc_s.so.1 \
|
||||
/lib/x86_64-linux-gnu/libc.so.6 \
|
||||
/usr/lib/x86_64-linux-gnu/libc_nonshared.a \
|
||||
/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
|
||||
clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o
|
||||
|
||||
readelf --sections $t/exe | grep -q "
|
||||
[17] .got PROGBITS 0000000000202000 00002000
|
||||
0000000000000028 0000000000000000 WA 0 0 8
|
||||
[18] .got.plt PROGBITS 0000000000202028 00002028
|
||||
0000000000000020 0000000000000000 WA 0 0 8
|
||||
"
|
||||
readelf --sections $t/exe | fgrep -q '.got'
|
||||
readelf --sections $t/exe | fgrep -q '.got.plt'
|
||||
|
||||
readelf -x .got.plt $t/exe | grep -q "
|
||||
Hex dump of section '.got.plt':
|
||||
0x00202028 48202000 00000000 00000000 00000000 H .............
|
||||
0x00202038 00000000 00000000 16102000 00000000 .......... .....
|
||||
"
|
||||
|
||||
objdump -d -j .plt $t/exe | grep -q "
|
||||
Disassembly of section .plt:
|
||||
|
||||
0000000000201000 <printf@plt-0x10>:
|
||||
201000: ff 35 2a 10 00 00 pushq 0x102a(%rip) # 202030 <_GLOBAL_OFFSET_TABLE_+0x8>
|
||||
201006: ff 25 2c 10 00 00 jmpq *0x102c(%rip) # 202038 <_GLOBAL_OFFSET_TABLE_+0x10>
|
||||
20100c: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
|
||||
0000000000201010 <printf@plt>:
|
||||
201010: ff 25 2a 10 00 00 jmpq *0x102a(%rip) # 202040 <printf@GLIBC_2.2.5>
|
||||
201016: 68 00 00 00 00 pushq $0x0
|
||||
20101b: e9 e0 ff ff ff jmpq 201000 <_IO_stdin_used+0xb80>
|
||||
"
|
||||
$t/exe | grep -q 'Hello world'
|
||||
|
||||
echo OK
|
||||
|
Loading…
Reference in New Issue
Block a user