brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · dbfb48f Raw
63 lines · plain
1// REQUIRES: x862// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t3 4// Should use "_init" and "_fini" by default when fills dynamic table5// RUN: ld.lld -shared %t -o %t26// RUN: llvm-readobj --dynamic-table %t2 | FileCheck --check-prefix=BYDEF %s7// BYDEF: INIT 0x110108// BYDEF: FINI 0x110209 10// -init and -fini override symbols to use11// RUN: ld.lld -shared %t -o %t2 -init _foo -fini _bar12// RUN: llvm-readobj --dynamic-table %t2 | FileCheck --check-prefix=OVR %s13// OVR: INIT 0x1103014// OVR: FINI 0x1104015 16// Check aliases as well17// RUN: ld.lld -shared %t -o %t2 -init=_foo -fini=_bar18// RUN: llvm-readobj --dynamic-table %t2 | FileCheck --check-prefix=OVR %s19 20// Don't add an entry for undef. The freebsd dynamic linker doesn't21// check if the value is null. If it is, it will just call the22// load address.23// RUN: ld.lld -shared %t -o %t2 -init=_undef -fini=_undef24// RUN: llvm-readobj --dynamic-table %t2 | FileCheck --check-prefix=UNDEF %s25// UNDEF-NOT: INIT26// UNDEF-NOT: FINI27 28// Don't add an entry for shared. For the same reason as undef.29// RUN: ld.lld -shared %t -o %t.so30// RUN: echo > %t.s31// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t2.o32// RUN: ld.lld -shared %t2.o %t.so -o %t233// RUN: llvm-readobj --dynamic-table %t2 | FileCheck --check-prefix=SHARED %s34// SHARED-NOT: INIT35// SHARED-NOT: FINI36 37// Should not add new entries to the symbol table38// and should not require given symbols to be resolved39// RUN: ld.lld -shared %t -o %t2 -init=_unknown -fini=_unknown40// RUN: llvm-readobj --symbols --dynamic-table %t2 | FileCheck --check-prefix=NOENTRY %s41// NOENTRY: DynamicSection [42// NOENTRY-NOT: INIT43// NOENTRY-NOT: FINI44// NOENTRY: ]45// NOENTRY: Symbols [46// NOENTRY-NOT: Name: _unknown47// NOENTRY: ]48 49// Should not add entries for "_init" and "_fini" to the symbol table50// if the symbols are defined in non-fetched archive members.51// RUN: rm -f %t.a52// RUN: llvm-ar rcs %t.a %t53// RUN: ld.lld -shared -m elf_x86_64 -e _unknown %t.a -o %t.so54// RUN: llvm-nm %t.so | \55// RUN:   FileCheck %s --implicit-check-not=_init --implicit-check-not=_fini56 57.global _start,_init,_fini,_foo,_bar,_undef58_start:59_init = 0x1101060_fini = 0x1102061_foo  = 0x1103062_bar  = 0x1104063