bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/23854] -no-pie -export-dynamic corrupts binary


From: hjl.tools at gmail dot com
Subject: [Bug ld/23854] -no-pie -export-dynamic corrupts binary
Date: Sun, 04 Nov 2018 20:41:22 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23854

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2018-11-04
                 CC|                            |hjl.tools at gmail dot com
     Ever confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
dpmi.o has:

    8f69:       8b 83 00 00 00 00       mov    0x0(%ebx),%eax   8f6b:
R_386_GOT32X      DPMI_return_from_realmode
    8f6f:       66 05 00 48             add    $0x4800,%ax
    8f73:       66 2b 83 00 00 00 00    sub    0x0(%ebx),%ax    8f76:
R_386_GOT32X      DPMI_dummy_start
    8f7a:       66 89 46 30             mov    %ax,0x30(%esi)

Only the lower 16 bits of GOT slot are used. It leads to:

address@hidden pr23854]$ cat pr23854.s
        .data
        .type   bar, @object
bar:
        .byte   1
        .size   bar, .-bar
        .globl  foo
        .type   foo, @object
foo:
        .byte   1
        .size   foo, .-foo
        .text
        .globl  _start
        .type   _start, @function
_start:
        adcw    address@hidden(%ecx), %ax
        addw    address@hidden(%ecx), %bx
        andw    address@hidden(%ecx), %cx
        cmpw    address@hidden(%ecx), %dx
        orw     address@hidden(%ecx), %di
        sbbw    address@hidden(%ecx), %si
        subw    address@hidden(%ecx), %bp
        xorw    address@hidden(%ecx), %sp
        testw   %cx, address@hidden(%ecx)
        adcw    address@hidden(%ecx), %ax
        addw    address@hidden(%ecx), %bx
        andw    address@hidden(%ecx), %cx
        cmpw    address@hidden(%ecx), %dx
        orw     address@hidden(%ecx), %di
        sbbw    address@hidden(%ecx), %si
        subw    address@hidden(%ecx), %bp
        xorw    address@hidden(%ecx), %sp
        testw   %cx, address@hidden(%ecx)
        .size   _start, .-_start
address@hidden pr23854]$ make
as --32  -o pr23854.o pr23854.s
ld -melf_i386 -o pr23854 pr23854.o
address@hidden pr23854]$ objdump -dw pr23854

pr23854:     file format elf32-i386


Disassembly of section .text:

08049000 <_start>:
 8049000:       66 81 d0 00 a0          adc    $0xa000,%ax
 8049005:       04 08                   add    $0x8,%al
 8049007:       66 81 c3 00 a0          add    $0xa000,%bx
 804900c:       04 08                   add    $0x8,%al
 804900e:       66 81 e1 00 a0          and    $0xa000,%cx
 8049013:       04 08                   add    $0x8,%al
 8049015:       66 81 fa 00 a0          cmp    $0xa000,%dx
 804901a:       04 08                   add    $0x8,%al
 804901c:       66 81 cf 00 a0          or     $0xa000,%di
 8049021:       04 08                   add    $0x8,%al
 8049023:       66 81 de 00 a0          sbb    $0xa000,%si
 8049028:       04 08                   add    $0x8,%al
 804902a:       66 81 ed 00 a0          sub    $0xa000,%bp
 804902f:       04 08                   add    $0x8,%al
 8049031:       66 81 f4 00 a0          xor    $0xa000,%sp
 8049036:       04 08                   add    $0x8,%al
 8049038:       66 f7 c1 00 a0          test   $0xa000,%cx
 804903d:       04 08                   add    $0x8,%al
 804903f:       66 81 d0 01 a0          adc    $0xa001,%ax
 8049044:       04 08                   add    $0x8,%al
 8049046:       66 81 c3 01 a0          add    $0xa001,%bx
 804904b:       04 08                   add    $0x8,%al
 804904d:       66 81 e1 01 a0          and    $0xa001,%cx
 8049052:       04 08                   add    $0x8,%al
 8049054:       66 81 fa 01 a0          cmp    $0xa001,%dx
 8049059:       04 08                   add    $0x8,%al
 804905b:       66 81 cf 01 a0          or     $0xa001,%di
 8049060:       04 08                   add    $0x8,%al
 8049062:       66 81 de 01 a0          sbb    $0xa001,%si
 8049067:       04 08                   add    $0x8,%al
 8049069:       66 81 ed 01 a0          sub    $0xa001,%bp
 804906e:       04 08                   add    $0x8,%al
 8049070:       66 81 f4 01 a0          xor    $0xa001,%sp
 8049075:       04 08                   add    $0x8,%al
 8049077:       66 f7 c1 01 a0          test   $0xa001,%cx
 804907c:       04 08                   add    $0x8,%al
address@hidden pr23854]$ 

Does dpmi.o contain normal i386 code?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]