[all-commits] [llvm/llvm-project] fb7f65: [SPARC][IAS] Emit the correct ELF machine type (#9...

Koakuma via All-commits all-commits at lists.llvm.org
Wed Jul 3 05:15:01 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fb7f65ba468f462103599e762c86f49b420cd984
      https://github.com/llvm/llvm-project/commit/fb7f65ba468f462103599e762c86f49b420cd984
  Author: Koakuma <koachan at protonmail.com>
  Date:   2024-07-03 (Wed, 03 Jul 2024)

  Changed paths:
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h
    A llvm/test/MC/Sparc/elf-sparc-machine-type.s

  Log Message:
  -----------
  [SPARC][IAS] Emit the correct ELF machine type (#96583)

Emit the correct machine type when writing out ELF objects.
This patch is modeled on GCC's behavior:
- `-m32` emits an object of type EM_SPARC;
- `-m32 -mcpu=v9` emits EM_SPARC32PLUS (however, see below); and
- `-m64` emits EM_SPARCV9.

Note that GCC does not guarantee emission of EM_SPARC32PLUS objects,
since GNU as doesn't support user control of emitted machine type.
It will always autodetect the type based on the instruction mix:
- If there's a V9 instruction inside, then emit EM_SPARC32PLUS; and
- Emit EM_SPARC otherwise.

For LLVM we choose deterministic behavior instead for simplicity.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list