[PATCH] D37477: [ELF] - Linkerscript: implement REGION_ALIAS.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 02:28:44 PDT 2017


grimar added inline comments.


================
Comment at: ELF/ScriptParser.cpp:403
+    setError("memory region '" + Name + "' is not defined");
+  if (!ErrorCount)
+    Script->Opt.MemoryRegions[Alias] = Script->Opt.MemoryRegions[Name];
----------------
ruiu wrote:
> It'll eventually fail if you call `setError`, so don't worry too much about `ErrorCount`. I'd remove this `if` and execute the following line unconditionally.
Done.


================
Comment at: ELF/ScriptParser.cpp:1240-1242
+    MemoryRegion *MR = make<MemoryRegion>();
+    *MR = {Name, Origin, Length, Flags, NegFlags};
+    Script->Opt.MemoryRegions[Name] = MR;
----------------
ruiu wrote:
> Does this work?
> 
>   Script->Opt.MemoryRegions[Name] =
>     make<MemoryRegion>(Name, Origin, Length, Flags, NegFlags);
Nope. Error is: "'lld::elf::MemoryRegion::MemoryRegion': no overloaded function takes 5 arguments",
that is why I did not do that initially. I believe it will work if we add constructor taking these 5 to
`MemoryRegion`, but does not seems it really worth to do for me.


https://reviews.llvm.org/D37477





More information about the llvm-commits mailing list