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

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 02:39:32 PDT 2024


================
@@ -552,6 +552,33 @@ static Error loadNewSectionData(StringRef ArgValue, StringRef OptionName,
   return Error::success();
 }
 
+static Expected<int64_t> parseAdjustSectionLMA(StringRef ArgValue,
+                                               StringRef OptionName) {
+  StringRef StringValue;
+  if (ArgValue.starts_with("*+")) {
+    StringValue = ArgValue.slice(2, StringRef::npos);
+  } else if (ArgValue.starts_with("*-")) {
+    StringValue = ArgValue.slice(1, StringRef::npos);
+  } else {
+    return createStringError(errc::invalid_argument,
+                             "bad format for " + OptionName +
+                                 ": it is required that all sections "
----------------
jh7370 wrote:

I think you should rephrase this to something like "changing a specific section LMA is not supported. Use *+val or *-val instead"

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


More information about the llvm-commits mailing list