[PATCH] D22912: [ELF] - Linkerscript: implemented ASSERT() keyword.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 03:58:59 PDT 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:366
@@ -365,3 +365,3 @@
     auto *Cmd = dyn_cast<SymbolAssignment>(Base.get());
-    if (!Cmd || Cmd->Name == ".")
+    if (!Cmd || Cmd->Name == "." || Cmd->Name.empty())
       continue;
----------------
grimar wrote:
> grimar wrote:
> > ruiu wrote:
> > > I didn't even look at other changes in this patch, but I think I can say the new check looks very weird. SymbolAssignment is for assignments. If it is not an assignment, you need to define a new type. Please don't give a new (obscure) meaning by defining a special case.
> > Ok. Actually I was thinking about it as about expression that calculates itself but assigns to nothing.
> > If you thing it should be another type, I`ll do that.
> > 
> > SymbolAssignment is for assignments. If it is not an assignment, you need to define a new type.
> By the way, we treat PROVIDE as SymbolAssignment. I think it is also a command and not an assigment.
I reimplemented this. At first I was thinking about creating some generic class like MiscellaneousCommand.
But after looking at the lists of possible LS commands:
https://sourceware.org/binutils/docs/ld/Simple-Commands.html#Simple-Commands

I think that ASSERT is probably the only one we need to add into queue. All others seems to be easy to
proccess inplace (like we do with ENTRY, for example). So I ended up with AssertCommand.



https://reviews.llvm.org/D22912





More information about the llvm-commits mailing list