<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - bx instruction generated with -march=armv4 needs --fix-v4bx with external assembler"
   href="https://llvm.org/bugs/show_bug.cgi?id=28952">28952</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>bx instruction generated with -march=armv4 needs --fix-v4bx with external assembler
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>raj.khem@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This program below

extern void (*foo_func) ();
void
foo ()
{
  (*foo_func) ();
}

when compiled like below using armv4 for march, ends up wit errors when
assembling

"/mnt/oe/openembedded-core/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-as"
-mfloat-abi=softfp -march=armv4 -o a.o /tmp/kraj01/a-0c2038.s
/tmp/kraj01/a-0c2038.s: Assembler messages:
/tmp/kraj01/a-0c2038.s:27: Error: selected processor does not support `bx r0'
in ARM mode

The reason is that when using GNU bintuils we need to pass --fix-v4bx to
assembler and linker when using -march=armv4, to support EABI

here is compile cmd to reproduce it. key options are "-no-integrated-as
-march=armv4 -mfloat-abi=softfp -O2" if I add "-Wa,--fix-v4bx" it works. So
when driver detects that -no-integrated-as + -march-armv4 is used the
--fix-v4bx should be passed unconditionally to assembler 



"/mnt/oe/openembedded-core/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/clang-3.9"
-cc1 -triple armv4-oe-linux-gnueabi -S -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name a.c -mrelocation-model static
-mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
-no-integrated-as -mconstructor-aliases -target-cpu strongarm -target-feature
+soft-float-abi -target-feature +strict-align -target-abi aapcs-linux
-mfloat-abi soft -v -dwarf-column-info -debugger-tuning=gdb -coverage-file
/mnt/oe/openembedded-core/build/tmp-glibc/work/armv5e-oe-linux-gnueabi/gmp/6.1.1-r0/build/mpz/a.c
-resource-dir
/mnt/oe/openembedded-core/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/../lib/clang/3.9.0
-internal-isystem /usr/local/include -internal-isystem
/mnt/oe/openembedded-core/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/../lib/clang/3.9.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fno-dwarf-directory-asm -fdebug-compilation-dir
/mnt/oe/openembedded-core/build/tmp-glibc/work/armv5e-oe-linux-gnueabi/gmp/6.1.1-r0/build/mpz
-ferror-limit 19 -fmessage-length 238 -fallow-half-arguments-and-returns
-fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/kraj01/a-0c2038.s
-x c a.c</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>