Skip to content

Commit b64c1de

Browse files
authored
[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 06cecdc.
1 parent 3a14ffb commit b64c1de

File tree

2 files changed

+6
-0
lines changed

2 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.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s | llvm-readobj -h - | \
1111
# RUN: FileCheck %s --check-prefix=FREEBSD
1212
# FREEBSD: OS/ABI: FreeBSD
13+
14+
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-openbsd %s | llvm-readobj -h - | \
15+
# RUN: FileCheck %s --check-prefix=OPENBSD
16+
# OPENBSD: OS/ABI: OpenBSD

0 commit comments

Comments
 (0)