[llvm-bugs] [Bug 46942] New: data32 prefix in .code16 block is not respected

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 31 14:57:29 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46942

            Bug ID: 46942
           Summary: data32 prefix in .code16 block is not respected
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: i at maskray.me
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

# clang newer than 2020-07-30 is needed, otherwise there are other issues:
`unrecognized driver option -e`, `unrecognized infix operator !`, and a '*'
parser issue fixed by https://reviews.llvm.org/D84895

git clone git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
cd kexec-tools
./bootstrap
./configure CC=clang
make -j10

This failed with a linker error, which is a red herring.
# ld: error: kexec_test/kexec_test.o:(.text+0x104): relocation R_386_16 out of
range: 68320 is not in [-32768, 65535]

One issue I have noticed:

% cat a.s
.code16
  callw test16
  data32 call real_to_prot   ## the operand is 32-bit in GNU as but 16-bit in
MC

real_to_prot:
  ret
% as --32 a.s -o a.o
% llvm-mc -filetype=obj -triple=i386 a.s -o b.o
% diff -u =(objdump -drz a.o) =(objdump -drz b.o)
...
-00000000 <real_to_prot-0x9>:
-   0:  e8 fe ff 66 e8          call   e8670003 <real_to_prot+0xe866fffa>
+00000000 <real_to_prot-0x7>:
+   0:  e8 fe ff 66 e8          call   e8670003 <real_to_prot+0xe866fffc>
                        1: R_386_PC16   test16
    5:  00 00                   add    %al,(%eax)
-   7:  00 00                   add    %al,(%eax)

-00000009 <real_to_prot>:
-   9:  c3                      ret    
+00000007 <real_to_prot>:
+   7:  c3                      ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200731/6f6755e2/attachment.html>


More information about the llvm-bugs mailing list