From 9583e7713d97c347716d6622516140cfaa14d7e6 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 17 Oct 2024 14:27:29 -0700 Subject: [PATCH] Inject compiler flags as part of get_clang_flags. NFC I noticed these were a little out-of-place in #22751 --- emcc.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/emcc.py b/emcc.py index 617be15c106d6..52ee28c27547d 100644 --- a/emcc.py +++ b/emcc.py @@ -375,6 +375,15 @@ def get_clang_flags(user_args): if settings.INLINING_LIMIT: flags.append('-fno-inline-functions') + if settings.PTHREADS: + if '-pthread' not in user_args: + flags.append('-pthread') + elif settings.SHARED_MEMORY: + if '-matomics' not in user_args: + flags.append('-matomics') + if '-mbulk-memory' not in user_args: + flags.append('-mbulk-memory') + if settings.RELOCATABLE and '-fPIC' not in user_args: flags.append('-fPIC') @@ -842,14 +851,6 @@ def phase_setup(options, state, newargs): if settings.PTHREADS or settings.WASM_WORKERS: settings.SHARED_MEMORY = 1 - if settings.PTHREADS and '-pthread' not in newargs: - newargs += ['-pthread'] - elif settings.SHARED_MEMORY: - if '-matomics' not in newargs: - newargs += ['-matomics'] - if '-mbulk-memory' not in newargs: - newargs += ['-mbulk-memory'] - if settings.SHARED_MEMORY: settings.BULK_MEMORY = 1