[PATCH] D129336: [llvm-objcopy][ELF] Allow --set-section-flags src=... and --rename-section src=tst

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 01:06:02 PDT 2022


jhenderson added a comment.

If I'm not mistaken, this change does more than just enable --set-section-flags (and --set-section-alignment) to be run before --rename-section. In particular, I believe it now means that --rename-section can rename added sections, and that updated sections apply to sections with their original name, rather than renamed sections. (NB: I've only looked at these via code inspection, so might be misreading the code). I suspect these changes could potentially invalidate some workflows (whilst admittedly making new ones possible). For example, imagine I wanted to rename a section (e.g. to create a backup of it within the data), and then add a new section with the original name. This is no longer possible, I believe.



================
Comment at: llvm/test/tools/llvm-objcopy/ELF/set-section-attr-and-rename.test:15
+
+# RUN: not llvm-objcopy --rename-section=.foo=.bar --set-section-flags=.bar=alloc %t %t.2 2>&1 | FileCheck %s --check-prefix=SET-BAR
+
----------------
Nit: This line's getting quite long. Perhaps time to split it over two?

Aside: do we need a similar conflict error for --section-section-alignment?


================
Comment at: llvm/tools/llvm-objcopy/ObjcopyOptions.cpp:813
   // Prohibit combinations of --set-section-flags when the section name is used
-  // by --rename-section, either as a source or a destination.
+  // by the destination of a --rename-section.
   for (const auto &E : Config.SectionsToRename) {
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129336/new/

https://reviews.llvm.org/D129336



More information about the llvm-commits mailing list