16 lines
438 B
C
16 lines
438 B
C
// Accesses an extern global variable via R_X86_64_REX_GOTPCRELX.
|
|
// Tests that the GOT data slot + R_X86_64_GLOB_DAT flow works:
|
|
// the synthesized ELF declares the symbol as SHN_UNDEF in .dynsym,
|
|
// emits a GLOB_DAT reloc in .rela.dyn, and RTLD resolves it from
|
|
// the caller's global symbol table.
|
|
|
|
extern int the_answer;
|
|
|
|
int get_the_answer(void) {
|
|
return the_answer;
|
|
}
|
|
|
|
int double_the_answer(void) {
|
|
return the_answer * 2;
|
|
}
|