1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00
llvm-mirror/test/tools/llvm-size/elf-sysv.test
James Henderson 056055f8f6 [llvm-size][test] Improve llvm-size testing
This patch significantly improves the llvm-size testing. The changes
made are:

1) Change all tests to use yaml2obj instead of assembly or pre-canned
   inputs.
2) Move the tests out of the X86 directory, since they don't need to be
   there after 1).
3) Increased test coverage.
4) Added comments to explain purpose of tests.

I haven't attempted to add test coverage for all Mach-O related code, as
I am not familiar enough with that file format to be able to.

Reviewers: grimar, MaskRay

Differential Revision: https://reviews.llvm.org/D66134

llvm-svn: 368821
2019-08-14 10:17:34 +00:00

130 lines
3.5 KiB
Plaintext

## Show that llvm-sizes works correctly on a typical ELF input for sysv
## format. It also shows that the formatting is correct.
## FIXME: The rules demonstrated by this test are not quite what GNU size
## follows. See https://bugs.llvm.org/show_bug.cgi?id=42934.
# RUN: yaml2obj %s > %t.o
# RUN: llvm-size --format=sysv %t.o \
# RUN: | FileCheck %s --match-full-lines --strict-whitespace -DFILE=%t.o --implicit-check-not={{.}}
# RUN: llvm-size -A %t.o \
# RUN: | FileCheck %s --match-full-lines --strict-whitespace -DFILE=%t.o --implicit-check-not={{.}}
# CHECK:[[FILE]] :
# CHECK-NEXT:section size addr
# CHECK-NEXT:.progbits 1 2097152
# CHECK-NEXT:.symtab_shndx 4 524288
# CHECK-NEXT:.hash 64 65536
# CHECK-NEXT:.dynamic 128 32768
# CHECK-NEXT:.note 256 16384
# CHECK-NEXT:.nobits 512 8192
# CHECK-NEXT:.shlib 2048 2048
# CHECK-NEXT:.dynsym 4096 1024
# CHECK-NEXT:.init_array 8192 512
# CHECK-NEXT:.fini_array 16384 256
# CHECK-NEXT:.preinit_array 32768 128
# CHECK-NEXT:.group 65536 64
# CHECK-NEXT:.relr 131072 32
# CHECK-NEXT:.os_specific 262144 16
# CHECK-NEXT:.proc_specific 524288 8
# CHECK-NEXT:.user_specific 1048576 4
# CHECK-NEXT:Total 2096069
!ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .progbits
Type: SHT_PROGBITS
ShSize: 0x1
Address: 0x200000
- Name: .strtab
Type: SHT_STRTAB
ShSize: 0x2
Address: 0x100000
- Name: .symtab_shndx
Link: .symtab
Type: SHT_SYMTAB_SHNDX
ShSize: 0x4
Address: 0x80000
Entries:
- Name: .symtab
Type: SHT_SYMTAB
## .symtab's size has to be based on .symtab_shndx's size, hence the
## size not following the pattern of the other sections.
ShSize: 0x18
Address: 0x40000
- Name: .rela
Type: SHT_RELA
ShSize: 0x20
Address: 0x20000
- Name: .hash
Type: SHT_HASH
ShSize: 0x40
Address: 0x10000
- Name: .dynamic
Type: SHT_DYNAMIC
ShSize: 0x80
Address: 0x8000
- Name: .note
Type: SHT_NOTE
ShSize: 0x100
Address: 0x4000
- Name: .nobits
Type: SHT_NOBITS
ShSize: 0x200
Address: 0x2000
- Name: .rel
Type: SHT_REL
ShSize: 0x400
Address: 0x1000
- Name: .shlib
Type: SHT_SHLIB
ShSize: 0x800
Address: 0x800
- Name: .dynsym
Type: SHT_DYNSYM
ShSize: 0x1000
Address: 0x400
- Name: .init_array
Type: SHT_INIT_ARRAY
ShSize: 0x2000
Address: 0x200
- Name: .fini_array
Type: SHT_FINI_ARRAY
ShSize: 0x4000
Address: 0x100
- Name: .preinit_array
Type: SHT_PREINIT_ARRAY
ShSize: 0x8000
Address: 0x80
- Name: .group
Type: SHT_GROUP
ShSize: 0x10000
Address: 0x40
Info: 0
Members:
- Name: .relr
Type: SHT_RELR
ShSize: 0x20000
Address: 0x20
- Name: .os_specific
Type: 0x61234567
ShSize: 0x40000
Address: 0x10
- Name: .proc_specific
Type: 0x71234567
ShSize: 0x80000
Address: 0x8
- Name: .user_specific
Type: 0x81234567
ShSize: 0x100000
Address: 0x4
- Name: .null
Type: SHT_NULL
ShSize: 0x200000
Address: 0x2