This commit is contained in:
Alon Zakai 2015-06-02 14:52:42 -07:00
Родитель 387e0d3d13
Коммит 4e68c2dce1
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -93,7 +93,7 @@ f = open(filename, 'r')
data = f.read()
f.close()
if 'declare i32 @printf(' not in data:
if 'declare i32 @printf(' not in data and 'define internal i32 @printf(' not in data:
POSTAMBLE += '''
; [#uses=1]
declare i32 @printf(i8*, ...)
@ -172,6 +172,8 @@ for i in range(len(lines)):
in_func = False
if in_func:
added_entry = False
if 'printf' in lines[i] or '__fwritex' in lines[i] or '__towrite' in lines[i] or 'pop_arg391' in lines[i] or 'fmt_u' in lines[i] or 'pad(' in lines[i] or 'stdout_write' in lines[i] or 'stdio_write' in lines[i] or 'syscall' in lines[i]:
in_func = False # do not add logging in musl printing code, which would infinitely recurse
elif lines[i].startswith('}'):
in_func = False
elif in_func and not added_entry and ' = alloca' not in lines[i] and lines[i].startswith(' '):