<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 - big-endian arm32 linux kernel builds fail"
   href="https://bugs.llvm.org/show_bug.cgi?id=38770">38770</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>big-endian arm32 linux kernel builds fail
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>6.0
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>arnd@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The kernel uses "-no-integrated-as", so clang calls the GNU assembler instead.
When that assembler is targetted at little-endian output, we are missing the
-EB
flag, so the output ends up being little-endian anyway, and causing a link
failure in the end.

I could work around the problem by passing -EB to the assembler as well as the
linker, but I would expect this to be implied by -mbig-endian.

--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -45,8 +45,8 @@ KBUILD_CFLAGS +=-fno-omit-frame-pointer -mapcs
-mno-sched-prolog
 endif

 ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
-KBUILD_CPPFLAGS        += -mbig-endian
-KBUILD_BIARCHFLAGS += -mbig-endian
+KBUILD_CPPFLAGS        += -mbig-endian -Wa,-EB
+KBUILD_BIARCHFLAGS += -mbig-endian -Wa,-EB
 CHECKFLAGS     += -D__ARMEB__
 AS             += -EB
 KBUILD_LDFLAGS += -EB
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -17,6 +17,10 @@ VDSO_LDFLAGS += $(call cc-ldoption,
-Wl$(comma)--hash-style=sysv)
 VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id)
 VDSO_LDFLAGS += $(call cc-ldoption, -fuse-ld=bfd)

+ifdef CONFIG_CPU_BIG_ENDIAN
+VDSO_LDFLAGS += -Wl,-EB
+endif
+
 obj-$(CONFIG_VDSO) += vdso.o
 extra-$(CONFIG_VDSO) += vdso.lds
 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)</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>