aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-09-23 14:33:51 +0300
committerJukka Jylänki <jujjyl@gmail.com>2013-09-23 15:20:29 +0300
commitd3e5647bd49d2a4861e10531c76a61febe24e848 (patch)
tree53068f83ed18ad6d861a287d9ccc14d9c2d7127a /emcc
parent45f8f9c948c5548665438827e3d6b39a40eca06e (diff)
Make input file parsing in 'emcc' tool stricter. Don't silently fail if a file is missing or is a bitcode file if an archive file was expected, but issue an error and abort. Related to #1648.
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc19
1 files changed, 15 insertions, 4 deletions
diff --git a/emcc b/emcc
index 9a687bd8..60eaa388 100755
--- a/emcc
+++ b/emcc
@@ -976,9 +976,13 @@ try:
if (os.path.islink(arg) and os.path.realpath(arg).endswith(SOURCE_SUFFIXES + BITCODE_SUFFIXES + DYNAMICLIB_SUFFIXES + ASSEMBLY_SUFFIXES)):
arg = os.path.realpath(arg)
- if not arg.startswith('-') and (arg.endswith(SOURCE_SUFFIXES + BITCODE_SUFFIXES + DYNAMICLIB_SUFFIXES + ASSEMBLY_SUFFIXES) or shared.Building.is_ar(arg)): # we already removed -o <target>, so all these should be inputs
- newargs[i] = ''
- if os.path.exists(arg):
+ if not arg.startswith('-'):
+ if not os.path.exists(arg):
+ logging.error(arg + ': No such file or directory')
+ exit(1)
+
+ if arg.endswith(SOURCE_SUFFIXES + BITCODE_SUFFIXES + DYNAMICLIB_SUFFIXES + ASSEMBLY_SUFFIXES) or shared.Building.is_ar(arg): # we already removed -o <target>, so all these should be inputs
+ newargs[i] = ''
if arg.endswith(SOURCE_SUFFIXES):
input_files.append(arg)
has_source_inputs = True
@@ -998,8 +1002,15 @@ try:
newargs[i] = ''
else:
logging.warning(arg + ' is not valid LLVM bitcode')
+ elif arg.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)
else:
- logging.error(arg + ': No such file or directory')
+ logging.error(arg + ": Input file has an unknown suffix, don't know what to do with it!")
exit(1)
elif arg.startswith('-L'):
lib_dirs.append(arg[2:])