[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:35 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);
----------------
jh7370 wrote:
I have no idea what `SLMAV` is supposed to mean. Please don't abbreviate variable names unnecessarily.
https://github.com/llvm/llvm-project/pull/95431
More information about the llvm-commits
mailing list