Skip to content

Commit

Permalink
[LLMV] set OpenBSD's ELFOSABI by default
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ericson2314 committed Jul 10, 2024
1 parent 221d5c5 commit 9da46ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/include/llvm/MC/MCELFObjectWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/MC/ELF/osabi-freebsd.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# RUN: llvm-mc -filetype obj -triple amd64-freebsd %s | llvm-readobj -hS - | FileCheck %s
# CHECK: OS/ABI: FreeBSD
2 changes: 2 additions & 0 deletions llvm/test/MC/ELF/osabi-openbsd.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# RUN: llvm-mc -filetype obj -triple amd64-openbsd %s | llvm-readobj -hS - | FileCheck %s
# CHECK: OS/ABI: OpenBSD

0 comments on commit 9da46ac

Please sign in to comment.