<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 --- - FreeBSD clang 3.91 TARGET_ARCH=powerpc64 context: clang 3.9.1 can not compile/assemble the likes of llvm/projects/libunwind/src/UnwindRegistersSave.S"
   href="https://llvm.org/bugs/show_bug.cgi?id=31590">31590</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>FreeBSD clang 3.91 TARGET_ARCH=powerpc64 context: clang 3.9.1 can not compile/assemble the likes of llvm/projects/libunwind/src/UnwindRegistersSave.S
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </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>Backend: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>markmi@dsl-only.net
          </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>[I experiment with trying to use clang as the system
compiler for powerpc64 and powerpc.
I placed the report based on the assumption that clang is
supposed to be able to parse the likes of:
llvm/projects/libunwind/src/UnwindRegistersRestore.S
and
llvm/projects/libunwind/src/UnwindRegistersSave.S
for powerpc64 and for powerpc. If the UnwindRegisters*.S
notation is wrong then this submittal will need to be
reclassified to report the notation needing to be
fixed.]

Under head (-r311147 or so) of FreeBSD I attempted to build
using llvm's libunwind on & for powerpc64 (via the standard
FreeBSD build tools). This used FreeBSD's system clang 3.9.1
variant.

The result was reporting of syntax errors for the
UnwindRegisters*.S files (for example).

For example ";" was not treated as a start-of-comment and
the rest of the lines were parsed and reported on.

Another example is complaining about r3 in:
stw r0, 8(r3)

There are other types of examples as well.

Justin Hibbits reported the following about the notation:

The naked 'r*' and 'f*' register designations are a Darwinism.
SysV notation requires '%r*' and '%f*', or naked numbers.

(So it may be that the UnwindRegisters*.S files are not
correct?)

Supporting details:

/usr/bin/clang -B /usr/local/powerpc64-freebsd/bin/ -target
powerpc64-unknown-freebsd12.0
--sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/tmp
-B/usr/local/powerpc64-freebsd/bin/ -O2 -pipe  
-I/usr/src/contrib/llvm/projects/libunwind/include -I/usr/src/lib/libgcc_eh
-D_LIBUNWIND_IS_NATIVE_ONLY -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k
-Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int
-Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value
-Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion
-Wno-unused-local-typedef -Wno-switch -Wno-switch-enum
-Wno-knr-promoted-parameter  -Qunused-arguments    -c
/usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S -o
UnwindRegistersSave.o

reported the likes of:

. . .
/usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:104:3:
error: unrecognized instruction mnemonic
; On entry:
  ^
/usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:104:11:
error: unexpected token at start of statement
; On entry:
          ^
/usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:105:3:
error: unrecognized instruction mnemonic
; thread_state pointer is in r3
  ^
/usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:105:24:
error: unrecognized instruction mnemonic
; thread_state pointer is in r3
                       ^
/usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:105:30:
error: unrecognized instruction mnemonic
; thread_state pointer is in r3
                             ^
/usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:107:23:
error: unexpected token in directive
.globl unw_getcontext @ .type unw_getcontext,@function @ unw_getcontext:
                      ^
/usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:108:13:
error: invalid memory operand
  stw r0, 8(r3)
            ^
. . .</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>