[llvm] r238019 - Fix llvm-nm -S option.
Justin Bogner
mail at justinbogner.com
Fri May 22 09:18:32 PDT 2015
Rafael Espindola <rafael.espindola at gmail.com> writes:
> Author: rafael
> Date: Fri May 22 08:28:35 2015
> New Revision: 238019
>
> URL: http://llvm.org/viewvc/llvm-project?rev=238019&view=rev
> Log:
> Fix llvm-nm -S option.
>
> It is explicitly documented to have no effect on object formats where symbols
> don't have sizes.
>
> Modified:
> llvm/trunk/test/Object/nm-trivial-object.test
> llvm/trunk/tools/llvm-nm/llvm-nm.cpp
>
> Modified: llvm/trunk/test/Object/nm-trivial-object.test
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/nm-trivial-object.test?rev=238019&r1=238018&r2=238019&view=diff
> ==============================================================================
> --- llvm/trunk/test/Object/nm-trivial-object.test (original)
> +++ llvm/trunk/test/Object/nm-trivial-object.test Fri May 22 08:28:35 2015
> @@ -4,6 +4,8 @@ RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml
> RUN: | FileCheck %s -check-prefix COFF64
> RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \
> RUN: | FileCheck %s -check-prefix ELF
> +RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 -S \
> +RUN: | FileCheck %s -check-prefix ELF-SIZE
> RUN: llvm-nm -o %p/Inputs/trivial-object-test.elf-i386 \
> RUN: | FileCheck %s -check-prefix ELF-o
> RUN: llvm-nm -u %p/Inputs/trivial-object-test.elf-i386 \
> @@ -48,28 +50,28 @@ RUN: cp %p/Inputs/trivial-object-test.ma
> RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
>
>
> -COFF32: 00000000 {{.*}} d .data
> -COFF32-NEXT: 00000000 {{.*}} t .text
> -COFF32-NEXT: 00000000 0000000d d L_.str
> +COFF32: 00000000 d .data
> +COFF32-NEXT: 00000000 t .text
> +COFF32-NEXT: 00000000 d L_.str
> COFF32-NEXT: U _SomeOtherFunction
> -COFF32-NEXT: 00000000 {{.*}} T _main
> +COFF32-NEXT: 00000000 T _main
> COFF32-NEXT: U _puts
>
> -COFF64: 00000000 {{.*}} d .data
> -COFF64-NEXT: 00000000 {{.*}} t .text
> -COFF64-NEXT: 00000000 00000008 r ??__Ex@@YAXXZ
> -COFF64-NEXT: 00000000 0000000d d L.str
> +COFF64: 00000000 d .data
> +COFF64-NEXT: 00000000 t .text
> +COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
> +COFF64-NEXT: 00000000 d L.str
> COFF64-NEXT: U SomeOtherFunction
> -COFF64-NEXT: 00000000 {{.*}} T main
> +COFF64-NEXT: 00000000 T main
> COFF64-NEXT: U puts
>
> -COFF-COMMON: 00000000 00000000 b .bss
> -COFF-COMMON-NEXT: 00000000 00000000 d .data
> -COFF-COMMON-NEXT: 00000000 00000014 d .drectve
> -COFF-COMMON-NEXT: 00000000 00000000 n .file
> -COFF-COMMON-NEXT: 00000000 00000014 r .rdata$zzz
> -COFF-COMMON-NEXT: 00000000 00000000 t .text
> -COFF-COMMON-NEXT: 00000004 C _a
> +COFF-COMMON: 00000000 b .bss
> +COFF-COMMON-NEXT: 00000000 d .data
> +COFF-COMMON-NEXT: 00000000 d .drectve
> +COFF-COMMON-NEXT: 00000000 n .file
> +COFF-COMMON-NEXT: 00000000 r .rdata$zzz
> +COFF-COMMON-NEXT: 00000000 t .text
> +COFF-COMMON-NEXT: C _a
>
>
> ELF-NOT: U
> @@ -77,6 +79,11 @@ ELF: U SomeOtherFunction
> ELF: 00000000 T main
> ELF: U puts
>
> +FIXME: we should not print the size of undefined symbols.
> +ELF-SIZE: 00000000 U SomeOtherFunction
> +ELF-SIZE-NEXT: 00000000 00000024 T main
> +ELF-SIZE-NEXT: 00000000 U puts
> +
> ELF-o: {{.*}}/trivial-object-test.elf-i386: U SomeOtherFunction
> ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main
> ELF-o: {{.*}}/trivial-object-test.elf-i386: U puts
>
> Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=238019&r1=238018&r2=238019&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
> +++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Fri May 22 08:28:35 2015
> @@ -932,7 +932,7 @@ static void dumpSymbolNamesFromObject(Sy
> NMSymbol S;
> S.Size = UnknownAddressOrSize;
> S.Address = UnknownAddressOrSize;
> - if ((PrintSize || SizeSort) && isa<ObjectFile>(Obj)) {
> + if (PrintSize && isa<ELFObjectFileBase>(Obj)) {
Was the removal of "|| SizeSort" here intentional? It looks somewhat
reasonable, but you didn't mention it in the commit message.
> symbol_iterator SymI = I;
> if (error(SymI->getSize(S.Size)))
> break;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list