xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols-mix-globalize.test (revision 55c81d4282c5da0189711261a11537bc8a7fe85c)
1*55c81d42SFangrui Song# RUN: yaml2obj %s -o %t.o
26e4dc6f2SAlexander Shaposhnikov
36e4dc6f2SAlexander Shaposhnikov# Tests --keep-global-symbol when used in combination with --globalize-symbol on
46e4dc6f2SAlexander Shaposhnikov# a different symbol.
56e4dc6f2SAlexander Shaposhnikov
66e4dc6f2SAlexander Shaposhnikov# RUN: llvm-objcopy \
76e4dc6f2SAlexander Shaposhnikov# RUN:   --globalize-symbol Local1 \
86e4dc6f2SAlexander Shaposhnikov# RUN:   --keep-global-symbol Local2 \
96e4dc6f2SAlexander Shaposhnikov# RUN:   --globalize-symbol Weak1 \
106e4dc6f2SAlexander Shaposhnikov# RUN:   --keep-global-symbol Weak2 \
116e4dc6f2SAlexander Shaposhnikov# RUN:   --globalize-symbol Global1 \
126e4dc6f2SAlexander Shaposhnikov# RUN:   --keep-global-symbol Global2 \
136e4dc6f2SAlexander Shaposhnikov# RUN:   %t.o %t.2.o
1497c17e83SFangrui Song# RUN: llvm-readelf --symbols %t.2.o | FileCheck %s
156e4dc6f2SAlexander Shaposhnikov
166e4dc6f2SAlexander Shaposhnikov!ELF
176e4dc6f2SAlexander ShaposhnikovFileHeader:
186e4dc6f2SAlexander Shaposhnikov  Class:           ELFCLASS64
196e4dc6f2SAlexander Shaposhnikov  Data:            ELFDATA2LSB
206e4dc6f2SAlexander Shaposhnikov  Type:            ET_REL
216e4dc6f2SAlexander Shaposhnikov  Machine:         EM_X86_64
226e4dc6f2SAlexander ShaposhnikovSections:
236e4dc6f2SAlexander Shaposhnikov  - Name:          .text
246e4dc6f2SAlexander Shaposhnikov    Type:          SHT_PROGBITS
256e4dc6f2SAlexander Shaposhnikov    Flags:         [ SHF_ALLOC, SHF_EXECINSTR ]
266e4dc6f2SAlexander ShaposhnikovSymbols:
276e4dc6f2SAlexander Shaposhnikov  - Name:        Local1
286e4dc6f2SAlexander Shaposhnikov    Section:     .text
296e4dc6f2SAlexander Shaposhnikov  - Name:        Local2
306e4dc6f2SAlexander Shaposhnikov    Section:     .text
316e4dc6f2SAlexander Shaposhnikov  - Name:        Global1
326e4dc6f2SAlexander Shaposhnikov    Section:     .text
336da44ad7SGeorge Rimar    Binding:     STB_GLOBAL
346e4dc6f2SAlexander Shaposhnikov  - Name:        Global2
356e4dc6f2SAlexander Shaposhnikov    Section:     .text
366da44ad7SGeorge Rimar    Binding:     STB_GLOBAL
376da44ad7SGeorge Rimar  - Name:        Weak1
386da44ad7SGeorge Rimar    Section:     .text
396da44ad7SGeorge Rimar    Binding:     STB_WEAK
406da44ad7SGeorge Rimar  - Name:        Weak2
416da44ad7SGeorge Rimar    Section:     .text
426da44ad7SGeorge Rimar    Binding:     STB_WEAK
436e4dc6f2SAlexander Shaposhnikov
446e4dc6f2SAlexander Shaposhnikov# CHECK:      Symbol table '.symtab' contains 7 entries:
456e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT:    Num: Value Size Type Bind Vis Ndx Name
466e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT:      0: {{.*}}  LOCAL  {{.*}}
476e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT:      1: {{.*}}  LOCAL  {{.*}} Local2
486e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT:      2: {{.*}}  GLOBAL {{.*}} Local1
496e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT:      3: {{.*}}  GLOBAL {{.*}} Global1
506e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT:      4: {{.*}}  GLOBAL {{.*}} Global2
516e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT:      5: {{.*}}  GLOBAL {{.*}} Weak1
526e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT:      6: {{.*}}  WEAK   {{.*}} Weak2
53