[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


================
@@ -267,6 +267,14 @@ defm change_section_lma
     : Eq<"change-section-lma", "Shift LMA of non-zero-sized sections in the program header by <val>">,
       MetaVarName<"*{+|-}val">;
 
+defm change_section_address
+    : Eq<"change-section-address", "Set, or adjust the address of sections in <sectionpattern> to, "
+         "or by <val> in a relocatable file">,
+      MetaVarName<"sectionpattern{=|+|-}val">;
----------------
jh7370 wrote:

Similar comment to elsewhere: we generally don't specifically call out that a section name is a pattern in these options, and instead assume a singular section is specified (see e.g. --remove-section).

The grammar (especially the commas) doesn't look quite right to me. Could this be tweaked to something like `Set the address of the section to, or adjust it by, <val>`? I also don't think you need to call out "in a relocatable file" in the help text. The documentation can cover that and there's an error message that will prevent misuse.

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


More information about the llvm-commits mailing list