<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58737>58737</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            i386 ; generates code for target that doesn't support it (CET instructions)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          martin-0
      </td>
    </tr>
</table>

<pre>
    CPU target: i586, clang generates code that is not supported by target causing program to crash due to illegal instruction.
Illegal instruction is: endbr32

Tested on physical box running i386 FreeBSD 13.1.

CPU: Pentium/P55C (233.87-MHz 586-class CPU)
  Origin="GenuineIntel"  Id=0x543  Family=0x5  Model=0x4  Stepping=3
  Features=0x8001bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,MMX>

Simple "hello world" c code compiled with CFLAGS=-g -march=i586 -fcf-protection.

As target doesn't support flow control -fcf-protection should not be used. Similar bug to gcc one specified here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98667

I originally opened a PR on freebsd's bugzilla here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267401
but was instructed to go here.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNU12vmzgQ_TXwMgoCOwR44OFectNeaaONmrurvlUGJuDKsZFtNk1__Y5J041utVKlaPBkvo7nHLemv9bN4S_wwg7oI_4EMi83EWugU0IPMKBGKzw66EyP4EfhQTrQxoObp8lYjz201x_10InZSSqbrBmsOIM30FnhRuhnDI5UCgehQGrn7dx5aXQSpdsofXr9NUKDAiDUfWs5u6Xd7Bu6MJdSpvHqZEd1rfkGdtY6TJe83MDOIj4ft5DxJEsei-m6oe0BtZfzOWK7Q543ELGScZ6UxWr_8TvQDla0AOcgZLPqVgnwp5WD1BHfRox9QD1Lja_aoyIX4LWnQPotX3OAnThLdb35AHvanVqcNcDR4zQRTPL5ve8OhZ8tuiWnTNOsPUW82YXZzd_7F7LbYA7HYN-ODdn98VOwTfin-VyG8_5zxF8er3qU50kh3Y2NqJSBi7GqD1i7G52dOU9S0SYv0o_Q7P54-nAkCKsBVmdhu5HOQQ6wOnWnFXHq8ZGym31yd_J7g05HrPgpDTgpc6Eh2luj3jcBN5pZ9YuUWoTZYZ8AAZZKWGjnIchl6DoiGcFN2MmTJKAjWgzsjd5PQR1EH_0oLxn0nBg7kEfF30logo404_KF_KQbZMR3MjBUlZtN8XiDVzALrUKpK5iJFN-DgMOnoK8Tqah1tLPCwb3v_4CgsEt-5P8eErYp1ml2A9HOHi7C_dQ_YQgLMMuwJMY6I9Scs6JicV_zvuKViL30CutF7hF_fv9YT8beqVne7a_8SB9037y8PT47R3qPZ6vqdzsmicxtQpIhR6l_7p9A6VeilFzp3EwaZru8LHgRj3VbZQXbYJev21Ofr-krurZK-y7t05SzLFaiReXqKH8mVWq8wNKCzlG-jWXNUsayLM2yKq9ylvC-rLhI8xzFukXEaJ3iWUiVBBxh5bGtF0iBCgoq6bz7L0jPWQ4acRlH_cXsR2NrUrqXepXGy-x6wf4vNKOeYg">