Ticket #114 (closed defect: fixed)
wrong address computation with x86 elf pic
| Reported by: | Loren Merritt | Owned by: | |
|---|---|---|---|
| Priority: | P1 | Milestone: | |
| Component: | Object Format: elf | Version: | 0.6.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
yasm fails to generate position independent code. nasm on the same input works. In particular, "wrt ..gotpc" produces different offsets.
# yasm -f elf pic.asm -o pic.o # gcc pic.o -o pic # objdump -d pic | perl -ne 'print if /<main>/ .. /ret/' 08048340 <main>: 8048340: 53 push ebx 8048341: e8 00 00 00 00 call 8048346 <main+0x6> 8048346: 5b pop ebx 8048347: 81 c3 a9 11 00 00 add ebx,0x11a9 804834d: 8b 83 18 ef ff ff mov eax,[ebx-0x10e8] 8048353: 8b 00 mov eax,[eax] 8048355: 5b pop ebx 8048356: c3 ret # ./pic Segmentation fault # nasm -f elf pic.asm -o pic.o # gcc pic.o -o pic # objdump -d pic | perl -ne 'print if /<main>/ .. /ret/' 08048340 <main>: 8048340: 53 push ebx 8048341: e8 00 00 00 00 call 8048346 <main.getgot> 08048346 <main.getgot>: 8048346: 5b pop ebx 8048347: 81 c3 b2 11 00 00 add ebx,0x11b2 804834d: 8b 83 18 ef ff ff mov eax,[ebx-0x10e8] 8048353: 8b 00 mov eax,[eax] 8048355: 5b pop ebx 8048356: c3 ret # ./pic #
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
