Skip to content

Instantly share code, notes, and snippets.

@kripken
Created August 9, 2013 00:37
Show Gist options
  • Save kripken/6190207 to your computer and use it in GitHub Desktop.
Save kripken/6190207 to your computer and use it in GitHub Desktop.
diff --git a/emcc b/emcc
index 0eb4499..c6ecbf0 100755
--- a/emcc
+++ b/emcc
@@ -1066,15 +1066,14 @@ try:
if shared.Settings.CORRECT_SIGNS >= 2 or shared.Settings.CORRECT_OVERFLOWS >= 2 or shared.Settings.CORRECT_ROUNDINGS >= 2:
debug_level = 4 # must keep debug info to do line-by-line operations
if debug_level > 1 and closure:
logging.warning('disabling closure because debug info was requested')
closure = False
- assert shared.LLVM_TARGET in shared.COMPILER_OPTS
if shared.LLVM_TARGET == 'i386-pc-linux-gnu':
shared.Settings.TARGET_X86 = 1
shared.Settings.TARGET_LE32 = 0
assert 'le32-unknown-nacl' not in shared.COMPILER_OPTS
elif shared.LLVM_TARGET == 'le32-unknown-nacl':
shared.Settings.TARGET_LE32 = 1
shared.Settings.TARGET_X86 = 0
@@ -1113,15 +1112,15 @@ try:
# First, generate LLVM bitcode. For each input file, we get base.o with bitcode
for input_file in input_files:
if input_file.endswith(SOURCE_SUFFIXES):
logging.debug('compiling source file: ' + input_file)
input_file = shared.Building.preprocess(input_file, in_temp(uniquename(input_file)))
output_file = in_temp(unsuffixed(uniquename(input_file)) + '.o')
temp_files.append(output_file)
- args = newargs + ['-emit-llvm', '-c', input_file, '-o', output_file]
+ args = newargs + ['-c', input_file, '-o', output_file]
if input_file.endswith(CXX_SUFFIXES):
args += shared.EMSDK_CXX_OPTS
logging.debug("running:" + call + ' ' + ' '.join(args))
execute([call] + args) # let compiler frontend print directly, so colors are saved (PIPE kills that)
if not os.path.exists(output_file):
logging.error('compiler frontend failed to generate LLVM bitcode, halting')
sys.exit(1)
diff --git a/tools/shared.py b/tools/shared.py
index b3689c8..61fd279 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -531,37 +531,37 @@ try:
COMPILER_OPTS # Can be set in EM_CONFIG, optionally
except:
COMPILER_OPTS = []
# Force a simple, standard target as much as possible: target 32-bit linux, and disable various flags that hint at other platforms
COMPILER_OPTS = COMPILER_OPTS + ['-m32', '-U__i386__', '-U__i386', '-Ui386',
'-U__SSE__', '-U__SSE_MATH__', '-U__SSE2__', '-U__SSE2_MATH__', '-U__MMX__',
'-DEMSCRIPTEN', '-D__EMSCRIPTEN__', '-U__STRICT_ANSI__',
- '-D__IEEE_LITTLE_ENDIAN', '-fno-math-errno',
+ '-D__IEEE_LITTLE_ENDIAN', '-fno-math-errno']
#'-fno-threadsafe-statics', # disabled due to issue 1289
- '-target', LLVM_TARGET]
+ #'-target', LLVM_TARGET]
if LLVM_TARGET == 'le32-unknown-nacl':
COMPILER_OPTS = filter(lambda opt: opt != '-m32', COMPILER_OPTS) # le32 target is 32-bit anyhow, no need for -m32
COMPILER_OPTS += ['-U__native_client__', '-U__pnacl__', '-U__ELF__'] # The nacl target is originally used for Google Native Client. Emscripten is not NaCl, so remove the platform #define, when using their triple.
USE_EMSDK = not os.environ.get('EMMAKEN_NO_SDK')
if USE_EMSDK:
# Disable system C and C++ include directories, and add our own (using -idirafter so they are last, like system dirs, which
# allows projects to override them)
- EMSDK_OPTS = ['-nostdinc', '-Xclang', '-nobuiltininc', '-Xclang', '-nostdsysteminc',
- '-Xclang', '-isystem' + path_from_root('system', 'local', 'include'),
- '-Xclang', '-isystem' + path_from_root('system', 'include', 'libcxx'),
- '-Xclang', '-isystem' + path_from_root('system', 'include'),
- '-Xclang', '-isystem' + path_from_root('system', 'include', 'emscripten'),
- '-Xclang', '-isystem' + path_from_root('system', 'include', 'bsd'), # posix stuff
- '-Xclang', '-isystem' + path_from_root('system', 'include', 'libc'),
- '-Xclang', '-isystem' + path_from_root('system', 'include', 'gfx'),
- '-Xclang', '-isystem' + path_from_root('system', 'include', 'net'),
- '-Xclang', '-isystem' + path_from_root('system', 'include', 'SDL'),
+ EMSDK_OPTS = [#'-nostdinc', '-Xclang', '-nobuiltininc', '-Xclang', '-nostdsysteminc',
+ '-I' + path_from_root('system', 'local', 'include'),
+ '-I' + path_from_root('system', 'include', 'libcxx'),
+ '-I' + path_from_root('system', 'include'),
+ '-I' + path_from_root('system', 'include', 'emscripten'),
+ '-I' + path_from_root('system', 'include', 'bsd'), # posix stuff
+ '-I' + path_from_root('system', 'include', 'libc'),
+ '-I' + path_from_root('system', 'include', 'gfx'),
+ '-I' + path_from_root('system', 'include', 'net'),
+ '-I' + path_from_root('system', 'include', 'SDL'),
] + [
'-U__APPLE__', '-U__linux__'
]
if LLVM_TARGET != 'le32-unknown-nacl':
EMSDK_CXX_OPTS = ['-nostdinc++'] # le32 target does not need -nostdinc++
else:
EMSDK_CXX_OPTS = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment