[Openmp-commits] [PATCH] D106579: [libomptarget][amdgpu][nfc] Replace use of gelf.h with libelf.h

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jul 22 12:04:28 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG14e34a83b0d2: [libomptarget][amdgpu][nfc] Replace use of gelf.h with libelf.h (authored by JonChesterfield).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106579/new/

https://reviews.llvm.org/D106579

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


Index: openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -15,10 +15,7 @@
 #include <cstdio>
 #include <cstdlib>
 #include <cstring>
-#include <elf.h>
-#include <fstream>
 #include <functional>
-#include <iostream>
 #include <libelf.h>
 #include <list>
 #include <memory>
Index: openmp/libomptarget/plugins/amdgpu/impl/system.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/impl/system.cpp
+++ openmp/libomptarget/plugins/amdgpu/impl/system.cpp
@@ -3,13 +3,9 @@
  *
  * This file is distributed under the MIT License. See LICENSE.txt for details.
  *===------------------------------------------------------------------------*/
-#include <gelf.h>
 #include <libelf.h>
 
 #include <cassert>
-#include <fstream>
-#include <iomanip>
-#include <set>
 #include <sstream>
 #include <string>
 
@@ -465,11 +461,10 @@
     return failure;
   }
 
+  Elf64_Phdr *pHdrs = elf64_getphdr(e);
   for (size_t i = 0; i < numpHdrs; ++i) {
-    GElf_Phdr pHdr;
-    if (gelf_getphdr(e, i, &pHdr) != &pHdr) {
-      continue;
-    }
+    Elf64_Phdr pHdr = pHdrs[i];
+
     // Look for the runtime metadata note
     if (pHdr.p_type == PT_NOTE && pHdr.p_align >= sizeof(int)) {
       // Iterate over the notes in this segment


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106579.360917.patch
Type: text/x-patch
Size: 1438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210722/487b50a3/attachment.bin>


More information about the Openmp-commits mailing list