[all-commits] [llvm/llvm-project] c1873d: [Clang][Driver] Pass through the --be8 endian flag...

simpal01 via All-commits all-commits at lists.llvm.org
Wed Jul 19 01:37:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c1873d84a3316fa03326e9157e799b81f63d7a10
      https://github.com/llvm/llvm-project/commit/c1873d84a3316fa03326e9157e799b81f63d7a10
  Author: Simi Pallipurath <simi.pallipurath at arm.com>
  Date:   2023-07-19 (Wed, 19 Jul 2023)

  Changed paths:
    M clang/lib/Driver/ToolChains/Arch/ARM.cpp
    M clang/lib/Driver/ToolChains/Arch/ARM.h
    M clang/lib/Driver/ToolChains/BareMetal.cpp
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/test/Driver/baremetal.cpp

  Log Message:
  -----------
  [Clang][Driver] Pass through the --be8 endian flag to linker in BareMetal driver For Arm.

When linking a big-endian image for Arm, clang has
to select  between BE8 and BE32 formats. The default
is dependent on the selected target architecture.
For ARMv6 and later architectures the default is
BE8, for older architectures the default is BE32.
For BE8 and BE32, compiler outputs a big endian ELF
relocatable object file with the instructions and
data both big endian. The difference is that at
link time, for BE8 a linker must endian reverse
the instructions to little endian. For BE8, the
clang has to pass --be8 to the linker for Arm.

At the moment clang is not passing the --be8 flag
to linker for the baremetal target architectures
above ArmV6 for Arm. This patch passes through --be8
and -BE or EL to the linker, taking into account the
target and the -mbig-endian and -mlittle-endian flag.
Also there are few more changes in the baremetal
driver so that the code can cope with AArch64 being
big-endian as well.

Reviewed By: michaelplatings, MaskRay

Differential Revision: https://reviews.llvm.org/D154786




More information about the All-commits mailing list