[PATCH] [lld][ELF] Add linker script ENTRY command

Michael Spencer bigcheesegs at gmail.com
Mon May 20 17:54:56 PDT 2013



================
Comment at: lib/Driver/Driver.cpp:58
@@ +57,3 @@
+  // Give target a chance to fix missing linker options.
+  targetInfo.maybeSetDefaultOptions();
+
----------------
Shankar Kalpathi Easwaran wrote:
> This should be probably converted to ELFTargetInfo and the values set in the ELFTargetInfo class.
This is non-elf-specific code.

================
Comment at: lib/ReaderWriter/LinkerScript.cpp:21-34
@@ -20,26 +20,16 @@
   switch (_kind) {
-  case Token::eof:
-    os << "eof: ";
-    break;
-  case Token::identifier:
-    os << "identifier: ";
-    break;
-  case Token::kw_as_needed:
-    os << "kw_as_needed: ";
-    break;
-  case Token::kw_group:
-    os << "kw_group: ";
-    break;
-  case Token::kw_output_format:
-    os << "kw_output_format: ";
-    break;
-  case Token::l_paren:
-    os << "l_paren: ";
-    break;
-  case Token::r_paren:
-    os << "r_paren: ";
-    break;
-  case Token::unknown:
-    os << "unknown: ";
+#define CASE(name)                              \
+  case Token::name:                             \
+    os << #name ": ";                           \
     break;
+  CASE(eof)
+  CASE(identifier)
+  CASE(kw_as_needed)
+  CASE(kw_entry)
+  CASE(kw_group)
+  CASE(kw_output_format)
+  CASE(l_paren)
+  CASE(r_paren)
+  CASE(unknown)
+#undef CASE
   }
----------------
Shankar Kalpathi Easwaran wrote:
> This will be hard to debug through a debugger. lets not stick to macros.
Macros are fine here. Nobody needs to debug this code, and this is a widely used pattern in LLVM.


http://llvm-reviews.chandlerc.com/D833

BRANCH
  linker-script-entry

ARCANIST PROJECT
  lld



More information about the llvm-commits mailing list