Skip to content

Commit bf713b5

Browse files
committed
Fix
1 parent 92229a3 commit bf713b5

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build]
22
target = "x86_64-unknown-linux-gnu"
3-
rustflags = ["-C", "link-args=-nostartfiles -nostdlib -static -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector -fno-plt -Wl,--build-id=none,--gc-sections,--no-eh-frame-hdr,-Tlink.ld", "-C", "target-feature=+avx,+avx2,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+fma,+f16c,+aes", "-C", "target-cpu=haswell"]
3+
rustflags = ["-C", "link-args=-nostartfiles -nostdlib -fno-exceptions -static -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector -fno-plt -Wl,--build-id=none,--gc-sections,--no-eh-frame-hdr,-Tlink.ld", "-C", "target-feature=+avx,+avx2,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+fma,+f16c,+aes", "-C", "relocation-model=pic", "-C", "target-cpu=haswell"]

scripts/gen.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import array
2-
import os
32
import sys
43

54
try:
@@ -8,9 +7,13 @@
87
print(f"Usage: {sys.argv[0]} binary_path template_path", file=sys.stderr)
98
sys.exit(1)
109

11-
code = bytearray((os.path.getsize(binary_path) + 7) // 8 * 8)
1210
with open(binary_path, "rb") as f:
13-
f.readinto(code)
11+
# remove prologue
12+
code = f.read()[4:]
13+
14+
rem = len(code) % 8
15+
if rem:
16+
code += b"\x00" * (8 - rem)
1417

1518
arr = array.array('Q')
1619
arr.frombytes(code)

scripts/remove-got.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def distance_u32(start, end):
2626
break
2727

2828
if got is None:
29+
with open(args.output, "wb") as f:
30+
f.write(binary)
2931
exit(0)
3032

3133
objdump = subprocess.check_output(["objdump", "-Fd", args.binary_path]).decode("utf-8").splitlines()

0 commit comments

Comments
 (0)