@@ -47,6 +47,13 @@ namespace lld::wasm {
4747Configuration *config;
4848Ctx ctx;
4949
50+ void errorOrWarn (const llvm::Twine &msg) {
51+ if (config->noinhibitExec )
52+ warn (msg);
53+ else
54+ error (msg);
55+ }
56+
5057void Ctx::reset () {
5158 objectFiles.clear ();
5259 stubFiles.clear ();
@@ -99,6 +106,16 @@ class LinkerDriver {
99106
100107 std::vector<InputFile *> files;
101108};
109+
110+ static bool hasZOption (opt::InputArgList &args, StringRef key) {
111+ bool ret = false ;
112+ for (const auto *arg : args.filtered (OPT_z))
113+ if (key == arg->getValue ()) {
114+ ret = true ;
115+ arg->claim ();
116+ }
117+ return ret;
118+ }
102119} // anonymous namespace
103120
104121bool link (ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
@@ -467,6 +484,10 @@ getBuildId(opt::InputArgList &args) {
467484
468485// Initializes Config members by the command line options.
469486static void readConfigs (opt::InputArgList &args) {
487+ config->allowMultipleDefinition =
488+ hasZOption (args, " muldefs" ) ||
489+ args.hasFlag (OPT_allow_multiple_definition,
490+ OPT_no_allow_multiple_definition, false );
470491 config->bsymbolic = args.hasArg (OPT_Bsymbolic);
471492 config->checkFeatures =
472493 args.hasFlag (OPT_check_features, OPT_no_check_features, true );
@@ -479,6 +500,7 @@ static void readConfigs(opt::InputArgList &args) {
479500 config->exportAll = args.hasArg (OPT_export_all);
480501 config->exportTable = args.hasArg (OPT_export_table);
481502 config->growableTable = args.hasArg (OPT_growable_table);
503+ config->noinhibitExec = args.hasArg (OPT_noinhibit_exec);
482504
483505 if (args.hasArg (OPT_import_memory_with_name)) {
484506 config->memoryImport =
@@ -1173,7 +1195,7 @@ static void splitSections() {
11731195
11741196static bool isKnownZFlag (StringRef s) {
11751197 // For now, we only support a very limited set of -z flags
1176- return s.starts_with (" stack-size=" );
1198+ return s.starts_with (" stack-size=" ) || s. starts_with ( " muldefs " ) ;
11771199}
11781200
11791201// Report a warning for an unknown -z option.
0 commit comments