MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / lld_flags

Function lld_flags

tools/building.py:297–337  ·  view source on GitHub ↗
(args, linker_inputs=None)

Source from the content-addressed store, hash-verified

295
296
297def lld_flags(args, linker_inputs=None):
298 # lld doesn't currently support --start-group/--end-group since the
299 # semantics are more like the windows linker where there is no need for
300 # grouping.
301 args = [a for a in args if a not in {'--start-group', '--end-group'}]
302
303 if settings.WASM_BINDGEN:
304 exported_symbols = get_wasm_bindgen_exported_symbols(linker_inputs)
305 args.extend(f'--export={e}' for e in exported_symbols)
306
307 # Emscripten currently expects linkable output (SIDE_MODULE/MAIN_MODULE) to
308 # include all archive contents.
309 if settings.LINKABLE and (settings.FAKE_DYLIBS or not settings.SIDE_MODULE):
310 args.insert(0, '--whole-archive')
311 args.append('--no-whole-archive')
312
313 if settings.STRICT and '--no-fatal-warnings' not in args:
314 args.append('--fatal-warnings')
315
316 if any(a in args for a in ('--strip-all', '-s')):
317 # Tell wasm-ld to always generate a target_features section even if --strip-all/-s
318 # is passed.
319 args.append('--keep-section=target_features')
320
321 if settings.MEMORY64:
322 args.append('-mwasm64')
323
324 for a in llvm_backend_args():
325 args += ['-mllvm', a]
326
327 if settings.WASM_EXCEPTIONS:
328 args += ['-mllvm', '-wasm-enable-eh']
329 if settings.WASM_EXCEPTIONS or settings.SUPPORT_LONGJMP == 'wasm':
330 if settings.WASM_LEGACY_EXCEPTIONS:
331 args += ['-mllvm', '-wasm-use-legacy-eh']
332 else:
333 args += ['-mllvm', '-wasm-use-legacy-eh=0']
334 if settings.WASM_EXCEPTIONS or settings.SUPPORT_LONGJMP == 'wasm':
335 args += ['-mllvm', '-exception-model=wasm']
336
337 return args
338
339
340def link_lld(args, target, external_symbols=None, linker_inputs=None):

Callers 1

link_lldFunction · 0.85

Calls 5

llvm_backend_argsFunction · 0.85
extendMethod · 0.80
appendMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected