aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt
diff options
context:
space:
mode:
authorWael Yehia <44115484+w2yehia@users.noreply.github.com>2024-02-16 12:55:20 -0500
committerllvmbot <llvmbot@llvm.org>2024-02-18 04:13:07 +0000
commitb27f0b4fae68fea5c2468bc080e31bcecfb7faa7 (patch)
tree1017512789ec59e8823d02ee4682e50862ab90fe /compiler-rt
parent82e17c153611fbb8c5bb9b990f0f143910a4c2e0 (diff)
downloadllvm-b27f0b4fae68fea5c2468bc080e31bcecfb7faa7.zip
llvm-b27f0b4fae68fea5c2468bc080e31bcecfb7faa7.tar.gz
llvm-b27f0b4fae68fea5c2468bc080e31bcecfb7faa7.tar.bz2
[AIX] Add a dummy variable in the __llvm_orderfile section (#81968)
to satisfy the __start___llvm_orderfile reference when linking with -bexpfull and -fprofile-generate on AIX. (cherry picked from commit 15cccc55919d27eb2e89379a65f6c7809f679fda)
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/profile/InstrProfilingPlatformAIX.c4
-rw-r--r--compiler-rt/test/profile/AIX/bexpfull-pgo.c7
2 files changed, 10 insertions, 1 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c b/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c
index 9f46a98..002bec1 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c
@@ -195,6 +195,8 @@ static const int dummy_name[0] COMPILER_RT_SECTION(
COMPILER_RT_SEG INSTR_PROF_NAME_SECT_NAME);
static int dummy_vnds[0] COMPILER_RT_SECTION(
COMPILER_RT_SEG INSTR_PROF_VNODES_SECT_NAME);
+static int dummy_orderfile[0] COMPILER_RT_SECTION(
+ COMPILER_RT_SEG INSTR_PROF_ORDERFILE_SECT_NAME);
// To avoid GC'ing of the dummy variables by the linker, reference them in an
// array and reference the array in the runtime registration code
@@ -206,7 +208,7 @@ static int dummy_vnds[0] COMPILER_RT_SECTION(
COMPILER_RT_VISIBILITY
void *__llvm_profile_keep[] = {(void *)&dummy_cnts, (void *)&dummy_bits,
(void *)&dummy_data, (void *)&dummy_name,
- (void *)&dummy_vnds};
+ (void *)&dummy_vnds, (void *)&dummy_orderfile};
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
diff --git a/compiler-rt/test/profile/AIX/bexpfull-pgo.c b/compiler-rt/test/profile/AIX/bexpfull-pgo.c
new file mode 100644
index 0000000..f48242e
--- /dev/null
+++ b/compiler-rt/test/profile/AIX/bexpfull-pgo.c
@@ -0,0 +1,7 @@
+// RUN: %clang_pgogen %s -bexpall
+// RUN: %clang_pgogen %s -bexpfull
+
+#include <string.h>
+int ar[10];
+int n;
+int main() { memcpy(ar, ar + 1, n); };