darling/tools/i386-map
Andrew Hyatt 5f96f6c7fb
Rename tools to remove their file extensions
This makes it easy to add the folder to PATH and run commands
2018-05-17 10:02:35 -04:00

35 lines
804 B
Python
Executable File

#!/usr/bin/env python
import fileinput
import subprocess
import sys, os
devnull = open(os.devnull, 'wb')
for line in fileinput.input():
line = line.rstrip()
orig_line = line
fixed = False
while True:
proc = subprocess.Popen("readelf -Ws /home/lubos/Projects/darling-root/lib32/darling/libstdcxx.so | grep " + line + "@@", shell=True, stdout=devnull, stderr=devnull)
proc.wait()
if proc.returncode != 0:
pos = line.rfind('m')
if pos == -1:
break
ll = list(line)
ll[pos] = 'j'
line = "".join(ll)
else:
fixed = True
break
if fixed:
print orig_line + ' = ' + line + ';'
else:
sys.stderr.write('Cannot fix ' + orig_line + '\n')