[PATCH] D23598: [ELF] Linkerscript: support assignment outside SECTIONS

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 19:21:33 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.h:70-72
@@ -69,2 +69,5 @@
   bool Hidden = false;
+
+  // Whether the "." is available.
+  bool DotAvailable = true;
 };
----------------
phosek wrote:
> ruiu wrote:
> > phosek wrote:
> > > ruiu wrote:
> > > > phosek wrote:
> > > > > ruiu wrote:
> > > > > > Let's remove this -- as I wrote in the previous comment, this is not an error we are detecting in other contexts, and it is okay to ignore them. I don't think it's a popular error, and it is "undefined behavior" (if there were the linker script language specification.)
> > > > > I believe we still need some way to recognize whether the assignment is inside `SECTIONS` or not to avoid modifying `.` in case it's not when assigning addresses inside `assignAddress()`?
> > > > Users shouldn't write an assignment outside SECTIONS with `.` as the RHS, so I don't think we need to worry too much about it.
> > > The problem is if `.` is on LHS (in the assignment outside `SECTIONS`) because this will affect all subsequent assignments (even those within `SECTIONS`).
> > Users shouldn't write `.` on LHS too, no?
> No they shouldn't, but if they do, shall we just produce incorrect output? I guess that's probably fine since we're not reporting error anyway?
Please do nothing and let it just create incorrect outputs for incorrect inputs. We may want to do more fine-grained error checking in future, but at this moment, this error check would be too much compared to other error checks. There are many interesting ways to produce broken output using linker scripts, and we are not trying to stop them from shooting them in the foot.


https://reviews.llvm.org/D23598





More information about the llvm-commits mailing list