[lld] d754c0b - [ELF] Make errorOrWarn opaque to decrease code size. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 29 19:31:14 PST 2022
Author: Fangrui Song
Date: 2022-01-29T19:31:09-08:00
New Revision: d754c0b64fe6c39ddc74b0a15430fce5997be1b1
URL: https://github.com/llvm/llvm-project/commit/d754c0b64fe6c39ddc74b0a15430fce5997be1b1
DIFF: https://github.com/llvm/llvm-project/commit/d754c0b64fe6c39ddc74b0a15430fce5997be1b1.diff
LOG: [ELF] Make errorOrWarn opaque to decrease code size. NFC
In my x86-64 lld, .text is -3.08Ki smaller.
Added:
Modified:
lld/ELF/Config.h
lld/ELF/Driver.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index 47bbed125cb13..72b7be8165e05 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -352,12 +352,7 @@ static inline ArrayRef<VersionDefinition> namedVersionDefs() {
return llvm::makeArrayRef(config->versionDefinitions).slice(2);
}
-static inline void errorOrWarn(const Twine &msg) {
- if (!config->noinhibitExec)
- error(msg);
- else
- warn(msg);
-}
+void errorOrWarn(const Twine &msg);
static inline void internalLinkerError(StringRef loc, const Twine &msg) {
errorOrWarn(loc + "internal linker error: " + msg + "\n" +
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index de26afddd28b8..e79788cc2ea8b 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -77,6 +77,13 @@ std::unique_ptr<LinkerDriver> elf::driver;
static void setConfigs(opt::InputArgList &args);
static void readConfigs(opt::InputArgList &args);
+void elf::errorOrWarn(const Twine &msg) {
+ if (config->noinhibitExec)
+ warn(msg);
+ else
+ error(msg);
+}
+
bool elf::link(ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
llvm::raw_ostream &stderrOS, bool exitEarly,
bool disableOutput) {
More information about the llvm-commits
mailing list