Skip to content

Commit 9da46ac

Browse files
committed
[LLMV] set OpenBSD's ELFOSABI by default
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 8738c5b / D107748. Added one for FreeBSD too for good measure.
1 parent 221d5c5 commit 9da46ac

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

llvm/include/llvm/MC/MCELFObjectWriter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ class MCELFObjectTargetWriter : public MCObjectTargetWriter {
7878
return ELF::ELFOSABI_FREEBSD;
7979
case Triple::Solaris:
8080
return ELF::ELFOSABI_SOLARIS;
81+
case Triple::OpenBSD:
82+
return ELF::ELFOSABI_OPENBSD;
8183
default:
8284
return ELF::ELFOSABI_NONE;
8385
}

llvm/test/MC/ELF/osabi-freebsd.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# RUN: llvm-mc -filetype obj -triple amd64-freebsd %s | llvm-readobj -hS - | FileCheck %s
2+
# CHECK: OS/ABI: FreeBSD

llvm/test/MC/ELF/osabi-openbsd.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# RUN: llvm-mc -filetype obj -triple amd64-openbsd %s | llvm-readobj -hS - | FileCheck %s
2+
# CHECK: OS/ABI: OpenBSD

0 commit comments

Comments
 (0)