[llvm] [llvm-objcopy] Add change-section-lma *+/-offset (PR #95431)
Eleanor Bonnici via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 08:52:24 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 "
+ "are either incremented, or decremented at "
+ "the same time; use *+val, "
+ "or *-val");
+ }
+ if (StringValue.empty())
+ return createStringError(errc::invalid_argument,
+ "bad format for " + OptionName +
+ ": missing offset of LMA");
+
+ auto SLMAV = getAsInteger<int64_t>(StringValue);
----------------
eleanor-arm wrote:
Done
https://github.com/llvm/llvm-project/pull/95431
More information about the llvm-commits
mailing list