<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - data32 prefix in .code16 block is not respected"
   href="https://bugs.llvm.org/show_bug.cgi?id=46942">46942</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>data32 prefix in .code16 block is not respected
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>i@maskray.me
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre># 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 <a href="https://reviews.llvm.org/D84895">https://reviews.llvm.org/D84895</a>

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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>