<html>
    <head>
      <base href="http://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 --- - AARCH64 asm("b %0":: "i" (&someFunc)) broken"
   href="http://llvm.org/bugs/show_bug.cgi?id=22761">22761</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AARCH64 asm("b %0":: "i" (&someFunc)) broken
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.6
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>axelheider@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang from LLVM release 3.5 and 3.6 crash for

   asm("b %0":: s"i" (&someFunc))

when targeting AARCH64. It works find for AARCH32.

A minimal example is:

//------------------------------------------------------------------------------
__noreturn static void someFunc(void) { ... }
__naked __noreturn void entry64(void) { asm("b %0":: "i" (&someFunc)); }
//------------------------------------------------------------------------------

The error is this:

0  clang           0x0000000002442fd8 llvm::sys::PrintStackTrace(_IO_FILE*) +
40
1  clang           0x000000000244441b
2  libpthread.so.0 0x00002acc467be340
3  clang           0x000000000197ac8f
llvm::AArch64InstPrinter::getRegisterName(unsigned int, unsigned int) + 63
4  clang           0x00000000018c1b17
5  clang           0x0000000001e19488
llvm::AsmPrinter::EmitInlineAsm(llvm::MachineInstr const*) const + 2984
6  clang           0x0000000001e0f950 llvm::AsmPrinter::EmitFunctionBody() +
1344
7  clang           0x00000000018bfd72
8  clang           0x0000000001ec7093
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 99
9  clang           0x00000000023dc3a7
llvm::FPPassManager::runOnFunction(llvm::Function&) + 311
10 clang           0x00000000023dc57b
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
11 clang           0x00000000023dc98a
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 794
12 clang           0x00000000008f004d
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) +
7773
13 clang           0x00000000008e5efb
14 clang           0x0000000000a69c83 clang::ParseAST(clang::Sema&, bool, bool)
+ 483
15 clang           0x0000000000716829 clang::FrontendAction::Execute() + 57
16 clang           0x00000000006eb5b3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 803
17 clang           0x00000000006d1a0b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2795
18 clang           0x00000000006c972e cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 702
19 clang           0x00000000006d0732 main + 11506
20 libc.so.6       0x00002acc47411ec5 __libc_start_main + 245
21 clang           0x00000000006c93a1
Stack dump:
0.    Program arguments: LLVM-V3.6/bin/clang -cc1 -triple aarch64-arm-none-eabi
-emit-obj -disable-free -disable-llvm-verifier -main-file-name test.c
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu generic
-target-feature +neon -target-abi aapcs -target-linker-version 2.24 -g
-dwarf-column-info -ffunction-sections -fdata-sections -coverage-file test.c.o
-resource-dir /test/LLVM-V3.6/bin/../lib/clang/3.6.0 -I /test/inc -O3 -Werror
-Wmissing-include-dirs -std=gnu11 -fdebug-compilation-dir /test -ferror-limit
19 -fmessage-length 159 -ffreestanding -mstackrealign
-fallow-half-arguments-and-returns -fno-signed-char -fobjc-runtime=gcc
-fdiagnostics-show-option -vectorize-loops -vectorize-slp -o test.c.o -x c
test.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'test.c'.
4.    Running pass 'AArch64 Assembly Printer' on function '@someFunc'
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.0 (tags/RELEASE_360/final)
Target: aarch64-arm-none-eabi
Thread model: posix</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>