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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 10:48:23 PDT 2017


ruiu 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];
----------------
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.


================
Comment at: ELF/ScriptParser.cpp:1240-1242
+    MemoryRegion *MR = make<MemoryRegion>();
+    *MR = {Name, Origin, Length, Flags, NegFlags};
+    Script->Opt.MemoryRegions[Name] = MR;
----------------
Does this work?

  Script->Opt.MemoryRegions[Name] =
    make<MemoryRegion>(Name, Origin, Length, Flags, NegFlags);


https://reviews.llvm.org/D37477





More information about the llvm-commits mailing list