Skip to content

Commit bf1316f

Browse files
author
Wael Yehia
committed
[AIX] Add a dummy variable in the __llvm_orderfile section
to satisfy the __start___llvm_orderfile reference when linking with -bexpfull and -fprofile-generate on AIX.
1 parent cc23574 commit bf1316f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

compiler-rt/lib/profile/InstrProfilingPlatformAIX.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ static const int dummy_name[0] COMPILER_RT_SECTION(
195195
COMPILER_RT_SEG INSTR_PROF_NAME_SECT_NAME);
196196
static int dummy_vnds[0] COMPILER_RT_SECTION(
197197
COMPILER_RT_SEG INSTR_PROF_VNODES_SECT_NAME);
198+
static int dummy_orderfile[0] COMPILER_RT_SECTION(
199+
COMPILER_RT_SEG INSTR_PROF_ORDERFILE_SECT_NAME);
198200

199201
// To avoid GC'ing of the dummy variables by the linker, reference them in an
200202
// array and reference the array in the runtime registration code
@@ -206,7 +208,7 @@ static int dummy_vnds[0] COMPILER_RT_SECTION(
206208
COMPILER_RT_VISIBILITY
207209
void *__llvm_profile_keep[] = {(void *)&dummy_cnts, (void *)&dummy_bits,
208210
(void *)&dummy_data, (void *)&dummy_name,
209-
(void *)&dummy_vnds};
211+
(void *)&dummy_vnds, (void *)&dummy_orderfile};
210212
#ifdef __GNUC__
211213
#pragma GCC diagnostic pop
212214
#endif
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %clang_pgogen %s -bexpall
2+
// RUN: %clang_pgogen %s -bexpfull
3+
4+
#include <string.h>
5+
int ar[10];
6+
int n;
7+
int main() {
8+
memcpy(ar, ar + 1, n);
9+
};

0 commit comments

Comments
 (0)