[PATCH] D29258: Print alignment in decimal instead of hexadecimal.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 09:26:49 PST 2017


readelf uses decimal, so there is precedent.

LGTM

Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:

> ruiu created this revision.
>
> Previously, we were printing out something like this for
> sections/symbols with alignment 16
>
>   0000000000201000 0000000000000182    10 .data
>
> which I think confusing. I think printing it in decimal is
> better.
>
>
> https://reviews.llvm.org/D29258
>
> Files:
>   lld/ELF/MapFile.cpp
>   lld/test/ELF/map-file.s
>
>
> Index: lld/test/ELF/map-file.s
> ===================================================================
> --- lld/test/ELF/map-file.s
> +++ lld/test/ELF/map-file.s
> @@ -24,7 +24,7 @@
>  .long bar - .
>  .long zed - .
>  local:
> -.comm   common,4,4
> +.comm   common,4,16
>  
>  // CHECK:      Address          Size             Align Out     In      File    Symbol
>  // CHECK-NEXT: 0000000000200158 0000000000000030     8 .eh_frame
> @@ -45,8 +45,8 @@
>  // CHECK-NEXT: 0000000000201014 0000000000000000     0                         bah
>  // CHECK-NEXT: 0000000000201014 0000000000000001     4                 {{.*}}{{/|\\}}map-file.s.tmp4.a(map-file.s.tmp4.o)
>  // CHECK-NEXT: 0000000000201014 0000000000000000     0                         baz
> -// CHECK-NEXT: 0000000000202000 0000000000000004     4 .bss
> -// CHECK-NEXT: 0000000000202000 0000000000000004     4         COMMON
> +// CHECK-NEXT: 0000000000202000 0000000000000004    16 .bss
> +// CHECK-NEXT: 0000000000202000 0000000000000004    16         COMMON
>  // CHECK-NEXT: 0000000000000000 0000000000000008     1 .comment
>  // CHECK-NEXT: 0000000000000000 00000000000000f0     8 .symtab
>  // CHECK-NEXT: 0000000000000000 00000000000000f0     8         .symtab
> Index: lld/ELF/MapFile.cpp
> ===================================================================
> --- lld/ELF/MapFile.cpp
> +++ lld/ELF/MapFile.cpp
> @@ -35,7 +35,7 @@
>  
>  static void writeOutSecLine(raw_fd_ostream &OS, int Width, uint64_t Address,
>                              uint64_t Size, uint64_t Align, StringRef Name) {
> -  OS << format("%0*llx %0*llx %5llx ", Width, Address, Width, Size, Align)
> +  OS << format("%0*llx %0*llx %5lld ", Width, Address, Width, Size, Align)
>       << left_justify(Name, 7);
>  }
>  
>
>
> Index: lld/test/ELF/map-file.s
> ===================================================================
> --- lld/test/ELF/map-file.s
> +++ lld/test/ELF/map-file.s
> @@ -24,7 +24,7 @@
>  .long bar - .
>  .long zed - .
>  local:
> -.comm   common,4,4
> +.comm   common,4,16
>  
>  // CHECK:      Address          Size             Align Out     In      File    Symbol
>  // CHECK-NEXT: 0000000000200158 0000000000000030     8 .eh_frame
> @@ -45,8 +45,8 @@
>  // CHECK-NEXT: 0000000000201014 0000000000000000     0                         bah
>  // CHECK-NEXT: 0000000000201014 0000000000000001     4                 {{.*}}{{/|\\}}map-file.s.tmp4.a(map-file.s.tmp4.o)
>  // CHECK-NEXT: 0000000000201014 0000000000000000     0                         baz
> -// CHECK-NEXT: 0000000000202000 0000000000000004     4 .bss
> -// CHECK-NEXT: 0000000000202000 0000000000000004     4         COMMON
> +// CHECK-NEXT: 0000000000202000 0000000000000004    16 .bss
> +// CHECK-NEXT: 0000000000202000 0000000000000004    16         COMMON
>  // CHECK-NEXT: 0000000000000000 0000000000000008     1 .comment
>  // CHECK-NEXT: 0000000000000000 00000000000000f0     8 .symtab
>  // CHECK-NEXT: 0000000000000000 00000000000000f0     8         .symtab
> Index: lld/ELF/MapFile.cpp
> ===================================================================
> --- lld/ELF/MapFile.cpp
> +++ lld/ELF/MapFile.cpp
> @@ -35,7 +35,7 @@
>  
>  static void writeOutSecLine(raw_fd_ostream &OS, int Width, uint64_t Address,
>                              uint64_t Size, uint64_t Align, StringRef Name) {
> -  OS << format("%0*llx %0*llx %5llx ", Width, Address, Width, Size, Align)
> +  OS << format("%0*llx %0*llx %5lld ", Width, Address, Width, Size, Align)
>       << left_justify(Name, 7);
>  }
>  


More information about the llvm-commits mailing list