blob: 8647c521e4a628e803bf376782223f139fcf252e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# REQUIRES: system-linux
# This test ensures that we will load .dynsym even if there's no .symtab section.
# We do this by compiling a small C program with a function and we direct the
# linker where to put the symbols so that in the end the layout is as follows:
#
# Symbol table '.dynsym' contains 4 entries:
# Num: Value Size Type Bind Vis Ndx Name
# 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
# 1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5
# 2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
# 3: 0000000000401110 13 FUNC GLOBAL DEFAULT 10 functionInDynsym
# We want to keep the symbol "functionInDynsym" in the .dynsym section and not
# have it put the default .symtab section.
# RUN: echo "{functionInDynsym;};" > %T/dynmic-symbols.txt
# RUN: %clang -Wl,--dynamic-list=%T/dynmic-symbols.txt -g -o %t.binary %p/Inputs/load-from-dynsym-alone.c
# Remove not needed symbols
# RUN: echo "functionInDynsym" > %t.keep_symbols
# RUN: llvm-objcopy --strip-all --remove-section .gdb_index --remove-section .comment --keep-symbols=%t.keep_symbols %t.binary
# Remove functionInDynsym symbol from .symtab (will leave symbol in .dynsym intact)
# RUN: llvm-strip --strip-symbol=functionInDynsym %t.binary
# RUN: %lldb -b -o 'b functionInDynsym' -o 'run' -o 'continue' %t.binary | FileCheck %s
# CHECK: (lldb) b functionInDynsym
# CHECK-NEXT: Breakpoint 1: where = {{.*}}.binary`functionInDynsym, address = 0x{{.*}}
# CHECK: (lldb) run
# CHECK-NEXT: Process {{.*}} stopped
# CHECK-NEXT: * thread #1, name = 'load-from-dynsy', stop reason = breakpoint 1.1
|