2018-06-06 21:56:51 +08:00
|
|
|
# REQUIRES: x86
|
2017-06-23 07:33:04 +08:00
|
|
|
# RUN: llvm-mc %s -filetype=obj -triple=x86_64-windows-msvc -o %t.obj
|
|
|
|
# RUN: not lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe 2>&1 | FileCheck %s
|
|
|
|
|
|
|
|
# secrel relocations against absolute symbols are errors.
|
|
|
|
|
[COFF] Allow debug info to relocate against discarded symbols
Summary:
In order to do this without switching on the symbol kind multiple times,
I created Defined::getChunkAndOffset and use that instead of
SymbolBody::getRVA in the inner relocation loop.
Now we get the symbol's chunk before switching over relocation types, so
we can test if it has been discarded outside the inner relocation type
switch. This also simplifies application of section relative
relocations. Previously we would switch on symbol kind to compute the
RVA, then the relocation type, and then the symbol kind again to get the
output section so we could subtract that from the symbol RVA. Now we
*always* have an OutputSection, so applying SECREL and SECTION
relocations isn't as much of a special case.
I'm still not quite happy with the cleanliness of this code. I'm not
sure what offsets and bases we should be using during the relocation
processing loop: VA, RVA, or OutputSectionOffset.
Reviewers: ruiu, pcc
Reviewed By: ruiu
Subscribers: majnemer, inglorion, llvm-commits, aprantl
Differential Revision: https://reviews.llvm.org/D34650
llvm-svn: 306566
2017-06-29 01:06:35 +08:00
|
|
|
# CHECK: SECREL relocation cannot be applied to absolute symbols
|
2017-06-23 07:33:04 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.global main
|
|
|
|
main:
|
|
|
|
ret
|
|
|
|
|
|
|
|
.section .rdata,"dr"
|
|
|
|
.secrel32 __guard_fids_table
|