[llvm] [llvm-objcopy] Add --change-section-address (PR #98664)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 19 02:40:11 PDT 2024
================
@@ -191,6 +152,61 @@ struct NewSectionInfo {
std::shared_ptr<MemoryBuffer> SectionData;
};
+// Flags set by --set-section-flags or --rename-section. Interpretation of these
+// is format-specific and not all flags are meaningful for all object file
+// formats. This is a bitmask; many section flags may be set.
+enum SectionFlag {
+ SecNone = 0,
+ SecAlloc = 1 << 0,
+ SecLoad = 1 << 1,
+ SecNoload = 1 << 2,
+ SecReadonly = 1 << 3,
+ SecDebug = 1 << 4,
+ SecCode = 1 << 5,
+ SecData = 1 << 6,
+ SecRom = 1 << 7,
+ SecMerge = 1 << 8,
+ SecStrings = 1 << 9,
+ SecContents = 1 << 10,
+ SecShare = 1 << 11,
+ SecExclude = 1 << 12,
+ SecLarge = 1 << 13,
+ LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/SecLarge)
+};
+
+struct SectionRename {
+ StringRef OriginalName;
+ StringRef NewName;
+ std::optional<SectionFlag> NewFlags;
+};
+
+struct SectionFlagsUpdate {
+ StringRef Name;
+ SectionFlag NewFlags;
+};
+
+struct AddressUpdate {
+ uint64_t Value = 0;
+ bool Absolute = false;
+ bool Negative = false;
+};
+
+struct SectionPatternAddressUpdate {
+ NameMatcher SectionPattern;
+ AddressUpdate Update;
+};
+
+struct SectionNameAddressUpdate {
----------------
jh7370 wrote:
Unused?
https://github.com/llvm/llvm-project/pull/98664
More information about the llvm-commits
mailing list