89 lines · yaml
1# Overlapping PT_LOAD and PT_TLS segments in an object file should be able to2# exist side by side.3 4# When an ELF file contains both PT_LOAD and PT_TLS segments where the PT_TLS5# segment has the same p_vaddr and p_paddr as a PT_LOAD segment, this6# was causing LLDB, when loading a ELF object file at an address, to overwrite7# the section load address for a PT_LOAD that shares the same p_vaddr value in8# the section load list's addr to section map for this code. This test ensures9# that no PT_TLS segments get loaded and can't interfere with real segments we10# need to resolved as all access to thread specific memory is only done via11# DWARF location expressions. We also don't have any code that loads any thread12# specific segments at a different address for different threads, so there is13# no reason currently to try and load thread specific segments.14 15# RUN: yaml2obj %s -o %t16# RUN: lldb-test object-file %t | FileCheck %s17 18 19# CHECK: Index: 020# CHECK-NEXT: ID: 0xffffffffffffffff21# CHECK-NEXT: Name: PT_LOAD[0]22# CHECK-NEXT: Type: container23# CHECK-NEXT: Permissions: rw-24# CHECK-NEXT: Thread specific: no25# CHECK-NEXT: VM address: 0x100026# CHECK-NEXT: VM size: 1627# CHECK-NEXT: File size: 1628# CHECK-NEXT: Showing 1 subsections29 30# CHECK: Index: 131# CHECK-NEXT: ID: 0xfffffffffffffffe32# CHECK-NEXT: Name: PT_TLS[0]33# CHECK-NEXT: Type: container34# CHECK-NEXT: Permissions: rw-35# CHECK-NEXT: Thread specific: yes36# CHECK-NEXT: VM address: 0x100037# CHECK-NEXT: VM size: 1638# CHECK-NEXT: File size: 039# CHECK-NEXT: Showing 1 subsections40 41# RUN: %lldb %t -b \42# RUN: -o "image lookup -a 0x1000" \43# RUN: -o "target modules load --file %t --slide 0" \44# RUN: -o "image lookup -a 0x1000" \45# RUN: -o "target dump section-load-list" \46# RUN: | FileCheck --check-prefix=LOOKUP %s47 48# LOOKUP-LABEL: image lookup -a 0x100049# LOOKUP: Address: {{.*}}.PT_LOAD[0]..data + 0)50# LOOKUP: target modules load51# LOOKUP: image lookup -a 0x100052# LOOKUP: Address: {{.*}}.PT_LOAD[0]..data + 0)53# LOOKUP: target dump section-load-list54# LOOKUP: PT_TLS-overlap-PT_LOAD.yaml.tmp.PT_LOAD[0]55# LOOKUP-NOT: PT_TLS-overlap-PT_LOAD.yaml.tmp.PT_TLS[0]56 57!ELF58FileHeader:59 Class: ELFCLASS3260 Data: ELFDATA2LSB61 Type: ET_EXEC62 Machine: EM_ARM63Sections:64 - Name: .data65 Type: SHT_PROGBITS66 Flags: [ SHF_ALLOC, SHF_WRITE ]67 Address: 0x100068 AddressAlign: 0x469 Size: 0x1070 - Name: .tbss71 Type: SHT_NOBITS72 Flags: [ SHF_ALLOC, SHF_WRITE, SHF_TLS ]73 Address: 0x100074 AddressAlign: 0x475 Size: 0x1076ProgramHeaders:77 - Type: PT_LOAD78 Flags: [ PF_W, PF_R ]79 VAddr: 0x100080 Align: 0x481 FirstSec: .data82 LastSec: .data83 - Type: PT_TLS84 Flags: [ PF_R, PF_W ]85 VAddr: 0x100086 Align: 0x487 FirstSec: .tbss88 LastSec: .tbss89