[LLD] Rename lld port driver entry function to a consistent name

Libraries linked to the lld elf library exposes a function named main.
When debugging code linked to such libraries and intending to set a
breakpoint at main, the debugger also sets breakpoint at the main
function at lld elf driver. The possible choice was to rename it to
link but that would again clash with lld::*::link. This patch tries
to consistently rename them to linkerMain.

Differential Revision: https://reviews.llvm.org/D91418
This commit is contained in:
Reshabh Sharma 2020-12-18 12:09:01 +05:30
parent 93fd52329f
commit fdd6ed8e93
5 changed files with 9 additions and 9 deletions

View File

@ -91,7 +91,7 @@ bool link(ArrayRef<const char *> args, bool canExitEarly, raw_ostream &stdoutOS,
symtab = make<SymbolTable>();
driver = make<LinkerDriver>();
driver->link(args);
driver->linkerMain(args);
// Call exit() if we can to avoid calling destructors.
if (canExitEarly)
@ -1197,7 +1197,7 @@ Optional<std::string> getReproduceFile(const opt::InputArgList &args) {
return None;
}
void LinkerDriver::link(ArrayRef<const char *> argsArr) {
void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
ScopedTimer rootTimer(Timer::root());
// Needed for LTO.

View File

@ -78,7 +78,7 @@ private:
class LinkerDriver {
public:
void link(llvm::ArrayRef<const char *> args);
void linkerMain(llvm::ArrayRef<const char *> args);
// Used by the resolver to parse .drectve section contents.
void parseDirectives(InputFile *file);

View File

@ -119,7 +119,7 @@ bool elf::link(ArrayRef<const char *> args, bool canExitEarly,
config->progName = args[0];
driver->main(args);
driver->linkerMain(args);
// Exit immediately if we don't need to return to the caller.
// This saves time because the overhead of calling destructors
@ -470,7 +470,7 @@ static void checkZOptions(opt::InputArgList &args) {
error("unknown -z value: " + StringRef(arg->getValue()));
}
void LinkerDriver::main(ArrayRef<const char *> argsArr) {
void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
ELFOptTable parser;
opt::InputArgList args = parser.parse(argsArr.slice(1));

View File

@ -26,7 +26,7 @@ extern class LinkerDriver *driver;
class LinkerDriver {
public:
void main(ArrayRef<const char *> args);
void linkerMain(ArrayRef<const char *> args);
void addFile(StringRef path, bool withLOption);
void addLibrary(StringRef name);

View File

@ -67,7 +67,7 @@ static void initLLVM() {
class LinkerDriver {
public:
void link(ArrayRef<const char *> argsArr);
void linkerMain(ArrayRef<const char *> argsArr);
private:
void createFiles(opt::InputArgList &args);
@ -98,7 +98,7 @@ bool link(ArrayRef<const char *> args, bool canExitEarly, raw_ostream &stdoutOS,
symtab = make<SymbolTable>();
initLLVM();
LinkerDriver().link(args);
LinkerDriver().linkerMain(args);
// Exit immediately if we don't need to return to the caller.
// This saves time because the overhead of calling destructors
@ -787,7 +787,7 @@ static void wrapSymbols(ArrayRef<WrappedSymbol> wrapped) {
symtab->wrap(w.sym, w.real, w.wrap);
}
void LinkerDriver::link(ArrayRef<const char *> argsArr) {
void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
WasmOptTable parser;
opt::InputArgList args = parser.parse(argsArr.slice(1));