Support rsp in linker intercept
This commit is contained in:
parent
e5cd808701
commit
dcbf46b8ef
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess, json, sys, os
|
||||
import subprocess, shutil, json, sys, os
|
||||
|
||||
FILTER = ['-shared']
|
||||
|
||||
@ -12,7 +12,11 @@ args = sys.argv[1:]
|
||||
out_args = []
|
||||
shareds = []
|
||||
search = []
|
||||
|
||||
def process_args(args):
|
||||
global out_args, shareds, search
|
||||
prev_o = False
|
||||
|
||||
for i in range(len(args)):
|
||||
if prev_o:
|
||||
prev_o = False
|
||||
@ -29,11 +33,23 @@ for i in range(len(args)):
|
||||
elif args[i].startswith('-l'):
|
||||
shareds.append(args[i][2:])
|
||||
continue
|
||||
elif args[i].endswith('.rsp'):
|
||||
fname = args[i][1:] # remove initial @
|
||||
with open(fname) as f:
|
||||
rsp = f.read().split()
|
||||
process_args(rsp)
|
||||
continue
|
||||
elif args[i].startswith('-L'):
|
||||
search.append(args[i][2:])
|
||||
out_args.append(args[i])
|
||||
|
||||
process_args(args)
|
||||
|
||||
with open(OUT, 'w') as f:
|
||||
json.dump({'cmd': out_args, 'libs': shareds, 'search': search}, f, indent=2)
|
||||
json.dump({
|
||||
'cmd': out_args,
|
||||
'libs': shareds,
|
||||
'search': search,
|
||||
}, f, indent=2)
|
||||
|
||||
subprocess.run([CXX] + args)
|
||||
|
Loading…
x
Reference in New Issue
Block a user