Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] - Don't crash when --emit-relocs is used with --gc-sections
We crashed when --emit-relocs was used and relocated section was collected by GC. Differential revision: https://reviews.llvm.org/D37561 llvm-svn: 313620
- Loading branch information
George Rimar
committed
Sep 19, 2017
1 parent
696a7f9
commit af52534
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# REQUIRES: x86 | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o | ||
|
||
## Show that we emit .rela.bar when GC is disabled. | ||
# RUN: ld.lld --emit-relocs %t.o -o %t | ||
# RUN: llvm-objdump %t -section-headers | FileCheck %s --check-prefix=NOGC | ||
# NOGC: .rela.bar | ||
|
||
## GC collects .bar section and we exclude .rela.bar from output. | ||
# RUN: ld.lld --gc-sections --emit-relocs --print-gc-sections %t.o -o %t \ | ||
# RUN: | FileCheck --check-prefix=MSG %s | ||
# MSG: removing unused section from '.bar' in file | ||
# MSG: removing unused section from '.rela.bar' in file | ||
# RUN: llvm-objdump %t -section-headers | FileCheck %s --check-prefix=GC | ||
# GC-NOT: rela.bar | ||
|
||
.section .bar,"a" | ||
.quad .bar |