-
-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously, a GOT relocation (e.g. R_X86_64_REX_GOTPCRELX) and a R_X86_64_64 relocation referring the same imported symbols were resolved to different addresses. Here is why: - When we saw a R_X86_64_64 relocation against an imported symbol, we created a PLT and resolve the relocation there. - GOT relocation is resolved to a GOT entry, which has a true address of an imported function at runtime, which is different from PLT entries that redirect calls to the real function. With this patch, we no longer create a PLT entry for R_X86_64_64. Instead, we emit a dynamic relocation so that it is always resolved to a real function address. Fixes GNU MP's `make check` failure, which was reported at #81
- Loading branch information
Showing
4 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
set -e | ||
cd $(dirname $0) | ||
echo -n "Testing $(basename -s .sh $0) ... " | ||
t=$(pwd)/tmp/$(basename -s .sh $0) | ||
mkdir -p $t | ||
|
||
cat <<EOF | cc -shared -o $t/a.so -xc - | ||
void fn() {} | ||
EOF | ||
|
||
cat <<EOF | cc -o $t/b.o -c -xc - | ||
#include <stdio.h> | ||
void fn(); | ||
void (*ptr)() = fn; | ||
int main() { | ||
printf("%d\n", fn == ptr); | ||
} | ||
EOF | ||
|
||
clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o $t/a.so | ||
$t/exe | grep -q 1 | ||
|
||
echo OK |