[Openmp-commits] [openmp] 71ae2e0 - [libomptarget][amdgpu] don't declare Elf_Note on FreeBSD
Dimitry Andric via Openmp-commits
openmp-commits at lists.llvm.org
Fri Aug 6 12:45:54 PDT 2021
Author: Dimitry Andric
Date: 2021-08-06T21:45:26+02:00
New Revision: 71ae2e0221a99958ed82175781d92a73ea05597c
URL: https://github.com/llvm/llvm-project/commit/71ae2e0221a99958ed82175781d92a73ea05597c
DIFF: https://github.com/llvm/llvm-project/commit/71ae2e0221a99958ed82175781d92a73ea05597c.diff
LOG: [libomptarget][amdgpu] don't declare Elf_Note on FreeBSD
On FreeBSD, the system `<libelf.h>` already declares `struct Elf_Note`
indirectly (via `<sys/elf_common.h>`). This results in compile errors
when building the libomptarget amdgpu plugin. Avoid redeclaring `struct
Elf_Note` on FreeBSD to fix the errors.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D107661
Added:
Modified:
openmp/libomptarget/plugins/amdgpu/impl/system.cpp
Removed:
################################################################################
diff --git a/openmp/libomptarget/plugins/amdgpu/impl/system.cpp b/openmp/libomptarget/plugins/amdgpu/impl/system.cpp
index 7fd8d57737e91..d9cbf461121c4 100644
--- a/openmp/libomptarget/plugins/amdgpu/impl/system.cpp
+++ b/openmp/libomptarget/plugins/amdgpu/impl/system.cpp
@@ -35,6 +35,8 @@ typedef unsigned char *address;
/*
* Note descriptors.
*/
+// FreeBSD already declares Elf_Note (indirectly via <libelf.h>)
+#if !defined(__FreeBSD__)
typedef struct {
uint32_t n_namesz; /* Length of note's name. */
uint32_t n_descsz; /* Length of note's value. */
@@ -43,6 +45,7 @@ typedef struct {
// then padding, optional
// then desc, at 4 byte alignment (not 8, despite being elf64)
} Elf_Note;
+#endif
// The following include file and following structs/enums
// have been replicated on a per-use basis below. For example,
More information about the Openmp-commits
mailing list