Doing so may result in these symbols being relocated via means of trampoline,
which breaks references to prefix data.
This can be demonstrated with the following setup:
- libtest.ll -------------------------------------------------------------------
define i32 @hello() prefix i32 42 {
ret i32 42
}
--------------------------------------------------------------------------------- main.c -----------------------------------------------------------------------
#include <stdio.h>
int hello(void);
int main() {
int *prefix_data = (int*) &hello;
printf("hi: %d\n", prefix_data[-1]);
return 0;
}
--------------------------------------------------------------------------------- Makefile -------------------------------------------------------------------- all : libtest.s main %.s : %.ll llc -o $@ $+ libtest.so : libtest.o gcc -shared -o $@ $+ main : main.o libtest.so gcc -fPIC -L. -ltest -o $@ $+ run : main LD_LIBRARY_PATH=. ./main clean : git clean -f --------------------------------------------------------------------------------
$ make run # should result in “hi: 42”
will result in hi: <random> on ARMv7 and Aarch64.