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

Reshabh Sharma via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 22:50:16 PST 2020


Author: Reshabh Sharma
Date: 2020-12-18T12:18:37+05:30
New Revision: fdd6ed8e9341f5161673e962cbd36e1f4c3968f5

URL: https://github.com/llvm/llvm-project/commit/fdd6ed8e9341f5161673e962cbd36e1f4c3968f5
DIFF: https://github.com/llvm/llvm-project/commit/fdd6ed8e9341f5161673e962cbd36e1f4c3968f5.diff

LOG: [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

Added: 
    

Modified: 
    lld/COFF/Driver.cpp
    lld/COFF/Driver.h
    lld/ELF/Driver.cpp
    lld/ELF/Driver.h
    lld/wasm/Driver.cpp

Removed: 
    


################################################################################
diff  --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 08862b062f91..96ac7957f557 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -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.

diff  --git a/lld/COFF/Driver.h b/lld/COFF/Driver.h
index dc766eeac8ed..6f71a37f729f 100644
--- a/lld/COFF/Driver.h
+++ b/lld/COFF/Driver.h
@@ -78,7 +78,7 @@ class ArgParser {
 
 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);

diff  --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index d7a6cd13ca11..3eaa893a3ff5 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -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));
 

diff  --git a/lld/ELF/Driver.h b/lld/ELF/Driver.h
index 3115e28d1669..96d040041c5a 100644
--- a/lld/ELF/Driver.h
+++ b/lld/ELF/Driver.h
@@ -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);
 

diff  --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp
index c1e888466628..fb699c55fc8c 100644
--- a/lld/wasm/Driver.cpp
+++ b/lld/wasm/Driver.cpp
@@ -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));
 


        


More information about the llvm-commits mailing list