[llvm-branch-commits] [openmp] ce268f0 - [libomptarget][amdgpu] don't declare Elf_Note on FreeBSD

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 31 21:03:19 PDT 2021


Author: Dimitry Andric
Date: 2021-08-31T21:03:02-07:00
New Revision: ce268f0eb9e71679a3d57edd95fc54db6c16d8a9

URL: https://github.com/llvm/llvm-project/commit/ce268f0eb9e71679a3d57edd95fc54db6c16d8a9
DIFF: https://github.com/llvm/llvm-project/commit/ce268f0eb9e71679a3d57edd95fc54db6c16d8a9.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

(cherry picked from commit 71ae2e0221a99958ed82175781d92a73ea05597c)

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 7fd8d57737e9..d9cbf461121c 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 llvm-branch-commits mailing list