[Openmp-commits] [PATCH] D107661: [libomptarget][amdgpu] don't declare Elf_Note on FreeBSD

Dimitry Andric via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 6 12:09:43 PDT 2021


dim created this revision.
dim added reviewers: JonChesterfield, jdoerfert, emaste.
Herald added subscribers: kerbowa, krytarowski, arichardson, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
dim requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: OpenMP.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107661

Files:
  openmp/libomptarget/plugins/amdgpu/impl/system.cpp


Index: openmp/libomptarget/plugins/amdgpu/impl/system.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/impl/system.cpp
+++ openmp/libomptarget/plugins/amdgpu/impl/system.cpp
@@ -35,6 +35,8 @@
 /*
  * 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 @@
   // 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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107661.364862.patch
Type: text/x-patch
Size: 758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210806/13bff9f1/attachment.bin>


More information about the Openmp-commits mailing list