[llvm] b64c1de - [MC] set OpenBSD's ELFOSABI by default (#98158)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 06:10:28 PDT 2024


Author: John Ericson
Date: 2024-07-11T09:10:24-04:00
New Revision: b64c1de714c50bec7493530446ebf5e540d5f96a

URL: https://github.com/llvm/llvm-project/commit/b64c1de714c50bec7493530446ebf5e540d5f96a
DIFF: https://github.com/llvm/llvm-project/commit/b64c1de714c50bec7493530446ebf5e540d5f96a.diff

LOG: [MC] set OpenBSD's ELFOSABI by default (#98158)

This matches what is done for FreeBSD.

OpenBSD has a few special program header types, and other such ELF
extensions. Setting the ELFOSABI like so will allow LLD to support them
without needlessly impacting non-OpenBSD ELFs.

Testing strategy matches 06cecdc60ec9ebfdd4d8cdb2586d201272bdf6bd.

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCELFObjectWriter.h
    llvm/test/MC/ELF/osabi.s

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCELFObjectWriter.h b/llvm/include/llvm/MC/MCELFObjectWriter.h
index d7c223cdcc07f..12237094ad86a 100644
--- a/llvm/include/llvm/MC/MCELFObjectWriter.h
+++ b/llvm/include/llvm/MC/MCELFObjectWriter.h
@@ -78,6 +78,8 @@ class MCELFObjectTargetWriter : public MCObjectTargetWriter {
         return ELF::ELFOSABI_FREEBSD;
       case Triple::Solaris:
         return ELF::ELFOSABI_SOLARIS;
+      case Triple::OpenBSD:
+        return ELF::ELFOSABI_OPENBSD;
       default:
         return ELF::ELFOSABI_NONE;
     }

diff  --git a/llvm/test/MC/ELF/osabi.s b/llvm/test/MC/ELF/osabi.s
index dc6ad2a349d75..44912f4987c11 100644
--- a/llvm/test/MC/ELF/osabi.s
+++ b/llvm/test/MC/ELF/osabi.s
@@ -10,3 +10,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s | llvm-readobj -h - | \
 # RUN:   FileCheck %s --check-prefix=FREEBSD
 # FREEBSD: OS/ABI: FreeBSD
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-openbsd %s | llvm-readobj -h - | \
+# RUN:   FileCheck %s --check-prefix=OPENBSD
+# OPENBSD: OS/ABI: OpenBSD


        


More information about the llvm-commits mailing list