Do not get confused by Apple GCC dylib special '-compatibility_version' and '-current_version' directives when scanning for input files. Fixes test_the_bullet on OSX after the previous commit.

This commit is contained in:
Jukka Jylänki 2013-09-23 19:41:36 +03:00
Родитель a507cd8807
Коммит 794624d295
1 изменённых файлов: 20 добавлений и 22 удалений

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

@ -978,7 +978,7 @@ try:
if i > 0:
prev = newargs[i-1]
if prev in ['-MT', '-MF', '-MQ', '-D', '-U', '-o', '-x', '-Xpreprocessor', '-include', '-imacros', '-idirafter', '-iprefix', '-iwithprefix', '-iwithprefixbefore', '-isysroot', '-imultilib', '-A', '-isystem', '-iquote', '-install_name', '-I', '-L']: continue # ignore this gcc-style argument
if prev in ['-MT', '-MF', '-MQ', '-D', '-U', '-o', '-x', '-Xpreprocessor', '-include', '-imacros', '-idirafter', '-iprefix', '-iwithprefix', '-iwithprefixbefore', '-isysroot', '-imultilib', '-A', '-isystem', '-iquote', '-install_name', '-compatibility_version', '-current_version', '-I', '-L']: continue # ignore this gcc-style argument
if (os.path.islink(arg) and os.path.realpath(arg).endswith(SOURCE_SUFFIXES + BITCODE_SUFFIXES + DYNAMICLIB_SUFFIXES + ASSEMBLY_SUFFIXES)):
arg = os.path.realpath(arg)
@ -994,29 +994,27 @@ try:
if arg_suffix.endswith(SOURCE_SUFFIXES):
input_files.append(arg)
has_source_inputs = True
elif arg_suffix.endswith(ASSEMBLY_SUFFIXES) or shared.Building.is_bitcode(arg): # this should be bitcode, make sure it is valid
input_files.append(arg)
elif arg_suffix.endswith(STATICLIB_SUFFIXES + DYNAMICLIB_SUFFIXES):
# if it's not, and it's a library, just add it to libs to find later
l = unsuffixed_basename(arg)
for prefix in LIB_PREFIXES:
if not prefix: continue
if l.startswith(prefix):
l = l[len(prefix):]
break
libs.append(l)
newargs[i] = ''
else:
# this should be bitcode, make sure it is valid
if arg_suffix.endswith(ASSEMBLY_SUFFIXES) or shared.Building.is_bitcode(arg):
input_files.append(arg)
elif arg_suffix.endswith(STATICLIB_SUFFIXES + DYNAMICLIB_SUFFIXES):
# if it's not, and it's a library, just add it to libs to find later
l = unsuffixed_basename(arg)
for prefix in LIB_PREFIXES:
if not prefix: continue
if l.startswith(prefix):
l = l[len(prefix):]
break
libs.append(l)
newargs[i] = ''
else:
logging.warning(arg + ' is not valid LLVM bitcode')
logging.warning(arg + ' is not valid LLVM bitcode')
elif arg_suffix.endswith(STATICLIB_SUFFIXES):
if not shared.Building.is_ar(arg):
if shared.Building.is_bitcode(arg):
logging.error(arg + ': File has a suffix of a static library ' + str(STATICLIB_SUFFIXES) + ', but instead is an LLVM bitcode file! When linking LLVM bitcode files, use one of the suffixes ' + str(BITCODE_SUFFIXES))
else:
logging.error(arg + ': Unknown format, not a static library!')
exit(1)
if not shared.Building.is_ar(arg):
if shared.Building.is_bitcode(arg):
logging.error(arg + ': File has a suffix of a static library ' + str(STATICLIB_SUFFIXES) + ', but instead is an LLVM bitcode file! When linking LLVM bitcode files, use one of the suffixes ' + str(BITCODE_SUFFIXES))
else:
logging.error(arg + ': Unknown format, not a static library!')
exit(1)
else:
logging.error(arg + ": Input file has an unknown suffix, don't know what to do with it!")
exit(1)