[ELF] Make errorOrWarn opaque to decrease code size. NFC

In my x86-64 lld, .text is -3.08Ki smaller.
This commit is contained in:
Fangrui Song 2022-01-29 19:31:09 -08:00
parent 815786eb67
commit d754c0b64f
2 changed files with 8 additions and 6 deletions

View File

@ -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" +

View File

@ -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) {