[lld] [ELF] Postpone "unable to move location counter backward" error (PR #66854)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 01:30:26 PDT 2023


================
@@ -345,8 +345,8 @@ class LinkerScript final {
   // Describe memory region usage.
   void printMemoryUsage(raw_ostream &os);
 
-  // Verify memory/lma overflows.
-  void checkMemoryRegions() const;
+  // Check backward location counter assignment and memory region/LMA overflows.
+  void checkDotAndMemoryRegions() const;
----------------
smithp35 wrote:

It may be better to have a more general name such as checkStableAddressScript() or checkFinalScriptConditions() rather than detail each check.

Reason I mention it is that there may be more checks that are worth delaying. For example in https://github.com/kernkonzept/fiasco/blob/master/src/kernel.arm.ld#L60 the assert will fail in LLD but not in GNU ld because the assert is evaluated eagerly before any addresses are assigned, wheras GNU ld evaluates them once at the end. In this case the assert can be moved to the end of the script.

Not sure that this particular function would be the place to do that though.

https://github.com/llvm/llvm-project/pull/66854


More information about the llvm-commits mailing list