1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3# RUN: echo "SECTIONS { \
4# RUN:    .got  : { *(.got) *(.got) } \
5# RUN:    .plt  : { *(.plt) } \
6# RUN:    .text : { *(.text) } \
7# RUN:  }" > %t.script
8# RUN: ld.lld -shared -o %t.so --script %t.script %t.o
9
10# RUN: llvm-readelf -S %t.so | FileCheck %s
11# CHECK-NOT:  .got
12# CHECK-NOT:  .plt
13# CHECK:      .dynsym
14# CHECK:      .text
15
16# Test that the size of a removed unused synthetic input section is not added
17# to the output section size. Adding a symbol assignment prevents removal of
18# the output section, but does not cause the section size to be recomputed.
19# RUN: echo "SECTIONS { \
20# RUN:    .got.plt : { a_sym = .; *(.got.plt) } \
21# RUN:  }" > %t2.script
22# RUN: ld.lld -shared -o %t2.so --script %t2.script %t.o
23# RUN: llvm-objdump --section-headers %t2.so | FileCheck %s --check-prefix=CHECK2
24# CHECK2: .got.plt 00000000
25
26.global _start
27_start:
28  nop
29