[Openmp-commits] [openmp] 86587f2 - [Libomptarget] Fix compiling with asserts using the bitcode library

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 9 13:25:38 PDT 2022


Author: Joseph Huber
Date: 2022-09-09T15:25:24-05:00
New Revision: 86587f289158b19b90bd72f7ab6f6ad1147835b3

URL: https://github.com/llvm/llvm-project/commit/86587f289158b19b90bd72f7ab6f6ad1147835b3
DIFF: https://github.com/llvm/llvm-project/commit/86587f289158b19b90bd72f7ab6f6ad1147835b3.diff

LOG: [Libomptarget] Fix compiling with asserts using the bitcode library

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

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D133594

Added: 
    openmp/libomptarget/test/api/assert.c

Modified: 
    openmp/libomptarget/DeviceRTL/src/exports

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/DeviceRTL/src/exports b/openmp/libomptarget/DeviceRTL/src/exports
index 49e5ea2831686..b175dd1f35dba 100644
--- a/openmp/libomptarget/DeviceRTL/src/exports
+++ b/openmp/libomptarget/DeviceRTL/src/exports
@@ -4,3 +4,4 @@ __kmpc_*
 
 memcmp
 printf
+__assert_fail

diff  --git a/openmp/libomptarget/test/api/assert.c b/openmp/libomptarget/test/api/assert.c
new file mode 100644
index 0000000000000..b1288777888ec
--- /dev/null
+++ b/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;
+}


        


More information about the Openmp-commits mailing list