Martin Storsjo | 1be9195 | 2019-01-23 11:54:51 +0000 | [diff] [blame] | 1 | RUN: %python %p/../Inputs/ungzip.py %p/Inputs/bigobj.o.gz > %t.in.o |
| 2 | |
| 3 | RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-BIG,SYMBOLS-ORIG |
| 4 | |
| 5 | # Do a plain copy, to check that section numbers in symbols referring |
| 6 | # to sections outside of the small object format are handled correctly. |
| 7 | RUN: llvm-objcopy -R '.text$4' %t.in.o %t.small.o |
| 8 | RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-BIG,SYMBOLS-ORIG |
| 9 | |
| 10 | # Remove a section, making the section count fit into a small object. |
| 11 | RUN: llvm-objcopy -R '.text$4' %t.in.o %t.small.o |
| 12 | RUN: llvm-objdump -t %t.small.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-SMALL,SYMBOLS-REMOVED-SMALL |
| 13 | |
| 14 | # Add a .gnu_debuglink section, forcing the object back to big format. |
| 15 | RUN: llvm-objcopy --add-gnu-debuglink=%t.in.o %t.small.o %t.big.o |
| 16 | llvm-objdump -t %t.big.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-BIG,SYMBOLS-REMOVED-BIG |
| 17 | |
| 18 | # In big object format, the .file symbol occupies one symbol table entry for |
| 19 | # the auxillary data, but needs two entries in the small format, forcing the |
| 20 | # raw symbol indices of later symbols to change. |
| 21 | SYMBOLS: SYMBOL TABLE: |
| 22 | SYMBOLS-NEXT: [ 0]{{.*}} (nx 1) {{.*}} .text |
| 23 | SYMBOLS-NEXT: AUX scnlen |
| 24 | SYMBOLS-SMALL-NEXT: [ 2]{{.*}} (nx 2) {{.*}} .file |
| 25 | SYMBOLS-BIG-NEXT: [ 2]{{.*}} (nx 1) {{.*}} .file |
| 26 | SYMBOLS-NEXT: AUX abcdefghijklmnopqrs |
| 27 | SYMBOLS-SMALL-NEXT: [ 5]{{.*}} (nx 0) {{.*}} foo |
| 28 | SYMBOLS-BIG-NEXT: [ 4]{{.*}} (nx 0) {{.*}} foo |
| 29 | |
| 30 | # Check that the section numbers outside of signed 16 bit int range |
| 31 | # are represented properly. After removing one section, the section |
| 32 | # numbers decrease. |
| 33 | SYMBOLS-ORIG: [ 5](sec 65280){{.*}} symbol65280 |
| 34 | SYMBOLS-REMOVED-SMALL: [ 6](sec 65279){{.*}} symbol65280 |
| 35 | SYMBOLS-REMOVED-BIG: [ 5](sec 65279){{.*}} symbol65280 |