[Openmp-commits] [PATCH] D133594: [Libomptarget] Fix compiling with asserts using the bitcode library

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 9 11:23:47 PDT 2022


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tianshilei1992, JonChesterfield, ronlieb, markdewing.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added a project: OpenMP.
Herald added a subscriber: openmp-commits.

Sumnmary:
A previous patch introduces an `exports` file which contains all the
symbol names that are not internalized in the bitcode library. This is
done to reduce the size of the bitcode library and only export needed
functions. This export file must contain all the functoins expected to
be called from the device. Since its introduction the `__assert_fail`
function used to be provided but was mistakenly not included. This patch
adds it.

Fixes #57656


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133594

Files:
  openmp/libomptarget/DeviceRTL/src/exports
  openmp/libomptarget/test/api/assert.c


Index: openmp/libomptarget/test/api/assert.c
===================================================================
--- /dev/null
+++ openmp/libomptarget/test/api/assert.c
@@ -0,0 +1,14 @@
+// RUN: %libomptarget-compile-run-and-check-generic
+
+#include <assert.h>
+#include <stdio.h>
+
+int main() {
+  int i = 1;
+#pragma omp target
+  assert(i > 0);
+
+  // CHECK: PASS
+  printf("PASS\n");
+  return 0;
+}
Index: openmp/libomptarget/DeviceRTL/src/exports
===================================================================
--- openmp/libomptarget/DeviceRTL/src/exports
+++ openmp/libomptarget/DeviceRTL/src/exports
@@ -4,3 +4,4 @@
 
 memcmp
 printf
+__assert_fail


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133594.459140.patch
Type: text/x-patch
Size: 665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220909/49756425/attachment.bin>


More information about the Openmp-commits mailing list