[llvm] [llvm-objcopy] Add change-section-lma *+/-offset (PR #95431)

Eleanor Bonnici via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 29 08:42:47 PDT 2024


================
@@ -670,6 +670,13 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig,
     }
   }
 
+  if (Config.ChangeSectionLMAValAll != 0) {
+    for (Segment &Seg : Obj.segments()) {
+      if (Seg.FileSize > 0)
+        Seg.PAddr += Config.ChangeSectionLMAValAll;
----------------
eleanor-arm wrote:

That's a very good point. I've added code to check for overflow/underflow. 

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


More information about the llvm-commits mailing list