[llvm-bugs] [Bug 47632] New: data32 ljmp in .code16 should select FARJMP32i instead of FARJMP16i

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 23 18:34:59 PDT 2020


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

            Bug ID: 47632
           Summary: data32 ljmp in .code16 should select FARJMP32i instead
                    of FARJMP16i
           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

This may be the last problem blocking assembling kexec-tools with the
integrated assembler (I reported another issue in bug 46942)

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

There is a red-herring "relocation R_386_16 out of range" issue. The problem
(according to -debug-only=asm-matcher) is that the wrong FARJMP16i is selected.

% cat a.s
.code16
.space 0x104, 0x90
data32 ljmp $(0x10000)>>4, $2f-0x10000
2:
movw %cs,%ax
% as --32 a.s -o a.o && llvm-mc -filetype=obj -triple=i386 a.s -o b.o
% diff -u =(objdump -mi386 -Maddr16,data16 -wdrz a.o) =(objdump -mi386
-Maddr16,data16 -wdrz b.o)
--- /tmp/zshZyzVFz      2020-09-23 18:30:43.748829551 -0700
+++ /tmp/zshLrHrMy      2020-09-23 18:30:43.756829581 -0700
@@ -1,5 +1,5 @@

-a.o:     file format elf32-i386
+b.o:     file format elf32-i386


 Disassembly of section .text:
@@ -265,5 +265,4 @@
  101:  90                      nop
  102:  90                      nop
  103:  90                      nop
- 104:  66 ea 0c 01 ff ff 00 10         ljmpl  $0x1000,$0xffff010c      106:
R_386_32   .text
- 10c:  8c c8                   mov    %cs,%ax
+ 104:  66 ea 0a 01 00 10 8c c8         ljmpl  $0xc88c,$0x1000010a      106:
R_386_16   .text


% llvm-mc -triple=i386 a.s -debug-only=asm-matcher
...
Trying to match opcode FARJMP32i
  Matching formal operand class MCK_Imm against actual operand at index 1
(Imm:4096): match success using generic matcher
  Matching formal operand class MCK_Imm against actual operand at index 2 ():
match success using generic matcher
  Matching formal operand class InvalidMatchClass against actual operand at
index 3: actual operand index out of range Missing target features: 1
Trying to match opcode FARJMP16i
  Matching formal operand class MCK_Imm against actual operand at index 1
(Imm:4096): match success using generic matcher
  Matching formal operand class MCK_Imm against actual operand at index 2 ():
match success using generic matcher
  Matching formal operand class InvalidMatchClass against actual operand at
index 3: actual operand index out of range Opcode result: complete match,
selecting this opcode
        ljmpw   $4096, $.Ltmp0-65536            # imm = 0x1000

-- 
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/20200924/8f8f52b7/attachment.html>


More information about the llvm-bugs mailing list