fix: specify full build path with patched_object_files

This commit is contained in:
Tropical
2026-03-14 22:08:09 -05:00
parent b735ccdbf0
commit 242b74cae7
2 changed files with 8 additions and 4 deletions

View File

@@ -110,6 +110,7 @@ patched_relocations = custom_target(
output: patched_object_files,
command: [
python, meson.project_source_root() / 'scripts/patch_relocations.py',
meson.current_build_dir(),
'@INPUT@',
],
)

View File

@@ -1,9 +1,9 @@
import sys, struct, shutil
import sys, struct, shutil, os
def patch_relocs(object_files):
def patch_relocs(build_dir, object_files):
patched = 0
for f in object_files:
outfile = f.replace('.obj', '.o')
outfile = os.path.join(build_dir, os.path.basename(f).replace('.obj', '.o'))
shutil.copy(f, outfile)
with open(outfile, 'rb+') as file:
@@ -35,4 +35,7 @@ def patch_relocs(object_files):
print(f"Patched {patched} 'type 40' relocations to standard GOTPCREL (9).")
if __name__ == '__main__':
patch_relocs(sys.argv[1:])
build_dir = sys.argv[1]
object_files = sys.argv[2:]
patch_relocs(build_dir, object_files)