[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


================
@@ -303,6 +303,15 @@ them.
 
  Shift LMA of non-zero-sized segments by ``<val>``.
 
+.. option:: --change-section-address <sectionpattern>{=+-}<val>, --adjust-section-vma
+
+ Change the address of ``<sectionpattern>`` to the specified value, or apply
+ offset to the current value. Can be specified multiple times to specify multiple
+ patterns. Each section is only modified by one --change-section-address
+ argument. Changes apply from the right of the command line. If a section name
+ matches multiple patterns, the rightmost change applies. Object file needs to be
+ relocatable.
----------------
jh7370 wrote:

I'd make a few changes here, per the inline edit.
```suggestion
 Change the address of sections that match ``<sectionpattern>`` to the specified value, or apply
` `+-<val>`` to the current value. Can be specified multiple times to specify multiple
 patterns. Each section is only modified by one ``--change-section-address``
 argument. Changes apply from the right of the command line. If a section name
 matches multiple patterns, the rightmost change applies. The object file needs to be
 relocatable.
```
I'm also wondering whether "needs to be relocatable" is strictly the right term. At least in our ecosystem, our shared libraries are considered relocatable, just not ET_REL (and this option would not apply to them). Is simply saying "needs to be an ET_REL object" or something to that effect okay?

Finally we should just name the metavar `section`, in line with other section-related options (all of which by default use wildcard names).

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


More information about the llvm-commits mailing list