[PATCH] D81760: [WebAssembly] Add warnings for -shared and -pie
Dan Gohman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 13:08:22 PDT 2020
sunfish created this revision.
Herald added subscribers: aheejin, jgravelle-google, sbc100, dschuff.
Herald added a project: LLVM.
The meaning of -shared and -pie are expected to be changed in the
future when Module Linking-style libraries are implemented. Begin
issuing warnings to give people a heads-up that they will be changing.
For compatibility with Emscripten, add a --emscripten-pic flag which
disables these warnings.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D81760
Files:
lld/wasm/Config.h
lld/wasm/Driver.cpp
lld/wasm/Options.td
Index: lld/wasm/Options.td
===================================================================
--- lld/wasm/Options.td
+++ lld/wasm/Options.td
@@ -199,3 +199,7 @@
defm thinlto_cache_policy: Eq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">;
def thinlto_jobs: J<"thinlto-jobs=">,
HelpText<"Number of ThinLTO jobs. Default to --threads=">;
+
+// Emscripten PIC mode.
+def emscripten_pic: F<"emscripten-pic">,
+ HelpText<"Enable Emscripten-style PIC">;
Index: lld/wasm/Driver.cpp
===================================================================
--- lld/wasm/Driver.cpp
+++ lld/wasm/Driver.cpp
@@ -332,6 +332,7 @@
config->demangle = args.hasFlag(OPT_demangle, OPT_no_demangle, true);
config->disableVerify = args.hasArg(OPT_disable_verify);
config->emitRelocs = args.hasArg(OPT_emit_relocs);
+ config->emscriptenPic = args.hasArg(OPT_emscripten_pic);
config->entry = getEntry(args);
config->exportAll = args.hasArg(OPT_export_all);
config->exportTable = args.hasArg(OPT_export_table);
@@ -456,6 +457,23 @@
if (config->sharedMemory)
error("-r and --shared-memory may not be used together");
}
+
+ // To begin to prepare for Module Linking-style shared libraries, start
+ // warning about uses of `-shared` and related flags outside of Emscripten
+ // mode, to give anyone using them a heads-up that they will be changing.
+ //
+ // Also, warn about flags which request explicit exports.
+ if (!config->emscriptenPic) {
+ // -shared will change meaning when Module Linking is implemented.
+ if (config->shared) {
+ warn("shared libraries are not yet implemented");
+ }
+
+ // -pie will change meaning when Module Linking is implemented.
+ if (config->pie) {
+ warn("PIE is not yet implemented");
+ }
+ }
}
// Force Sym to be entered in the output. Used for -u or equivalent.
Index: lld/wasm/Config.h
===================================================================
--- lld/wasm/Config.h
+++ lld/wasm/Config.h
@@ -27,6 +27,7 @@
bool compressRelocations;
bool demangle;
bool disableVerify;
+ bool emscriptenPic;
bool emitRelocs;
bool exportAll;
bool exportDynamic;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81760.270498.patch
Type: text/x-patch
Size: 2178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200612/603d6c8a/attachment.bin>
More information about the llvm-commits
mailing list