[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/20475] Linking PIC executables with a linker script that does no
From: |
whitequark at whitequark dot org |
Subject: |
[Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation |
Date: |
Tue, 30 Aug 2016 08:09:48 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=20475
whitequark at whitequark dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|FIXED |---
--- Comment #9 from whitequark at whitequark dot org ---
Reopening since further testing indicates that Alan's suggestion only worked
partially. My minimal testcase, as described in the first comment, works as
expected now, but the non-minimized one crashes, in a different way.
Specifically, it contains the rough equivalent of the following C code in Rust
(built as -fPIC as before):
struct fmt {
void (*fn)(void *arg);
void *arg;
}
void f() {
struct fmt x = {
.fn = h,
.arg = ...,
};
g(&x);
}
void g(struct fmt *x) {
x->fn(x->arg);
}
void h(void *arg);
The way it crashes is when calling x->fn(); it jumps into a garbage address.
It is not yet clear to me what is the root cause. However, I suspect that
R_OR1K_GOT16 is at fault, because pinning _GLOBAL_OFFSET_TABLE_ to the
beginning of .got as before makes the code work as expected.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/20475] New: Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation, whitequark at whitequark dot org, 2016/08/17
- [Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation, whitequark at whitequark dot org, 2016/08/17
- [Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation, whitequark at whitequark dot org, 2016/08/17
- [Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation, whitequark at whitequark dot org, 2016/08/17
- [Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation, whitequark at whitequark dot org, 2016/08/17
- [Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation, amodra at gmail dot com, 2016/08/17
- [Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation, whitequark at whitequark dot org, 2016/08/20
- [Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation, cvs-commit at gcc dot gnu.org, 2016/08/22
- [Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation, amodra at gmail dot com, 2016/08/22
- [Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation,
whitequark at whitequark dot org <=
- [Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation, whitequark at whitequark dot org, 2016/08/30