llvm-project/bolt/test/Inputs/indirect_goto.c
Ash Dobrescu 3bba268013
[BOLT] Support computed goto and allow map addrs inside functions (#120267)
Create entry points for addresses referenced by dynamic relocations and
allow getNewFunctionOrDataAddress to map addrs inside functions. By
adding addresses referenced by dynamic relocations as entry points. This
patch fixes an issue where bolt fails on code using computing goto's.
This also fixes a mapping issue with the bugfix from this PR:
https://github.com/llvm/llvm-project/pull/117766.
2025-03-19 14:55:59 +00:00

19 lines
244 B
C

int main(int argc, char *argv[]) {
static const void *T1[] = {&&L1, &&L2};
static const void *T2[] = {&&L2, &&L3};
const void **T = (argc > 1) ? T1 : T2;
int i = 0;
L0:
goto *T[argc];
L1:
++i;
L2:
i++;
L3:
i++;
return i;
}