reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux /dev/null -o %t.o
# RUN: ld.lld -shared %t.o -T %s -o %t
# RUN: llvm-readobj --dynamic-table --sections %t | FileCheck %s

## In spite of .rela.plt is empty, it might have been preserved because it is
## mentioned in the linker script. However, even in that case, we should not
## produce DT_JMPREL and DT_PLTGOT tags because this can cause a dynamic loader
## to write into slots in .got.plt it considers reserved to support lazy symbol
## resolution. In fact, as .got.plt is also empty, that memory might be
## allocated for something else.

# CHECK: Sections [
# CHECK:      Name: .rela.plt
# CHECK-NEXT: Type: SHT_RELA
# CHECK-NEXT: Flags [
# CHECK-NEXT:   SHF_ALLOC
# CHECK-NEXT: ]
# CHECK-NEXT: Address:
# CHECK-NEXT: Offset:
# CHECK-NEXT: Size: 0
# CHECK:      Name: .got.plt
# CHECK-NEXT: Type: SHT_PROGBITS
# CHECK-NEXT: Flags [
# CHECK-NEXT:   SHF_ALLOC
# CHECK-NEXT:   SHF_WRITE
# CHECK-NEXT: ]
# CHECK-NEXT: Address:
# CHECK-NEXT: Offset:
# CHECK-NEXT: Size: 0

# CHECK: DynamicSection [
# CHECK-NOT: JMPREL
# CHECK-NOT: PLTGOT

PHDRS {
  all PT_LOAD;
  dyn PT_DYNAMIC;
}
SECTIONS {
  .rela.plt : { *(.rela.plt) }: all
  .dynamic : { *(.dynamic) }: all : dyn
  .got.plt : {*(.got.plt)}: all
}