Recommend users use readelf instead of objdump to dump .comment contents.

readelf's output is much easier to read than objdump's as you can see below.

  $ readelf --string-dump .comment foo
  String dump of section '.comment':
    [     1]  GCC: (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
    [    2c]  clang version 5.0.0
    [    41]  Linker: LLD 5.0.0

  $ objdump -j .comment -s foo
  Contents of section .comment:
   0000 00474343 3a202855 62756e74 7520342e  .GCC: (Ubuntu 4.
   0010 382e342d 32756275 6e747531 7e31342e  8.4-2ubuntu1~14.
   0020 30342e33 2920342e 382e3400 636c616e  04.3) 4.8.4.clan
   0030 67207665 7273696f 6e20352e 302e3020  g version 5.0.0
   0040 004c696e 6b65723a 204c4c44 20352e30  .Linker: LLD 5.0
   0050 2e3000                               .0.

llvm-svn: 301515
This commit is contained in:
Rui Ueyama 2017-04-27 04:50:08 +00:00
parent c9d82b9e16
commit 42fca6e794
2 changed files with 2 additions and 2 deletions

View File

@ -97,7 +97,7 @@ static ArrayRef<uint8_t> getVersion() {
// Creates a .comment section containing LLD version info.
// With this feature, you can identify LLD-generated binaries easily
// by "objdump -s -j .comment <file>".
// by "readelf --string-dump .comment <file>".
// The returned object is a mergeable string section.
template <class ELFT> MergeInputSection *elf::createCommentSection() {
typename ELFT::Shdr Hdr = {};

View File

@ -135,7 +135,7 @@ LDFLAGS when building your programs.
LLD leaves its name and version number to a ``.comment`` section in an
output. If you are in doubt whether you are successfully using LLD or
not, run ``objdump -s -j .comment <output-file>`` and examine the
not, run ``readelf --string-dump .comment <output-file>`` and examine the
output. If the string "Linker: LLD" is included in the output, you are
using LLD.