Files
llvm-project/clang/test/CodeGen/zos-pragmas.cpp
Sean Perry 7638c1df0e [SystemZ][z/OS] Implement #pragma export (#141671)
Implement the export pragma that is used in the z/OS XL C/C++ compiler
to indicate that an external symbol is to be exported from the shared
library. The syntax for the pragma is:
```
'#pragma' 'export' '(' name ')'
```
For C++ if `name` is a function it needs to be declared `extern "C"`.

See the following for the XL documentation:
- https://www.ibm.com/docs/en/zos/3.1.0?topic=descriptions-pragma-export

This code was originally in PR
https://github.com/llvm/llvm-project/pull/111035. I have split it out
into separate PRs so the code for #pragma export is in one PR and the
code for _Export keyword is in another. See that original PR for earlier
comments.
2026-01-23 14:46:31 -05:00

12 lines
321 B
C++

// REQUIRES: systemz-registered-target
// RUN: %clang_cc1 -x c++ -emit-llvm -triple s390x-none-zos -fvisibility=hidden %s -o - | FileCheck %s
#pragma export(a) export(b) export(c)
int a,b,c;
void foo(void);
// CHECK: @a = global i32 0, align 4
// CHECK: @b = global i32 0, align 4
// CHECK: @c = global i32 0, align 4