llvm/bolt/test/Inputs/plt.c
Vladislav Khmelevsky 4956e0e197 [BOLT] Fix plt relocations symbol match
The bfd linker adds the symbol versioning string to the symbol name in symtab.
Skip the versioning part in order to find the registered PLT function.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

Differential Revision: https://reviews.llvm.org/D122039
2022-04-05 15:57:26 +03:00

21 lines
385 B
C

#include "stub.h"
void *(*memcpy_p)(void *dest, const void *src, unsigned long n);
void *(*memset_p)(void *dest, int c, unsigned long n);
int main() {
int a = 0xdeadbeef, b = 0;
memcpy_p = memcpy;
memcpy_p(&b, &a, sizeof(b));
if (b != 0xdeadbeef)
return 1;
memset_p = memset;
memset_p(&a, 0, sizeof(a));
if (a != 0)
return 1;
printf("Test completed\n");
}