[PATCH] D49870: [llvm-objcopy] Add support for --rename-section flags from gnu objcopy

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 27 16:32:47 PDT 2018


rupprecht marked 6 inline comments as done.
rupprecht added inline comments.


================
Comment at: tools/llvm-objcopy/llvm-objcopy.cpp:14
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
----------------
alexshap wrote:
> i think SmallVector should go before STLExtras
git-clang-format wants it here, unfortunately. Spot checking other LLVM files that include both of these, STLExtras comes first ~95% of the time.


================
Comment at: tools/llvm-objcopy/llvm-objcopy.cpp:233
+  if (!FlagValue.contains('='))
+    error("Bad format for --rename-section: expected '='");
+
----------------
alexshap wrote:
> is there a test for this error ? if not - would you mind adding one ?
> 
> + question (just in case): do the error messages match binutils' ones ?
There are tests for these -- and actually this once deviating from binutils, so I'll revert it.
I've updated the other error messages to match binutils, with the exception of unrecognized section flag, which requires a minor change to the error() method.

```
$ objcopy --rename-section=.foo=.bar,xyz 
objcopy: unrecognized section flag `xyz'
objcopy: supported flags: alloc, load, noload, readonly, debug, code, data, rom, share, contents, merge, strings
```
(the error methods here only allow a single line error message)


Repository:
  rL LLVM

https://reviews.llvm.org/D49870





More information about the llvm-commits mailing list