[llvm-bugs] [Bug 32775] New: LLD/COFF should not allow absolute symbols to be exported
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Apr 24 15:51:51 PDT 2017
http://bugs.llvm.org/show_bug.cgi?id=32775
Bug ID: 32775
Summary: LLD/COFF should not allow absolute symbols to be
exported
Product: lld
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: COFF
Assignee: unassignedbugs at nondot.org
Reporter: peter at pcc.me.uk
CC: llvm-bugs at lists.llvm.org
I don't think it's possible to represent an exported absolute symbol in the PE
format because all exported RVAs are adjusted to the image base. And indeed,
the MSVC linker rejects attempts to do so:
>type 2.s
.globl i
i = 42
>\src\llvm-project\ra\bin\llvm-mc -filetype=obj -o 2.obj 2.s
>link /dll /export:i 2.obj /defaultlib:libcmt
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
Creating library 2.lib and object 2.exp
2.exp : error LNK2016: absolute symbol 'i' used as target of ADDR32NB
relocation in section 1
LINK : fatal error LNK1165: link failed because of fixup errors
But we don't:
>..\llvm-project\ra\bin\lld-link /dll /export:i 2.obj /defaultlib:libcmt
And we create a bogus RVA:
>dumpbin /exports 2.dll
Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file 2.dll
File Type: DLL
Section contains the following exports for 2.dll
00000000 characteristics
0 time date stamp
0.00 version
0 ordinal base
2 number of functions
1 number of names
ordinal hint RVA name
1 0 8000002A i
Summary
1000 .00cfg
2000 .bss
1000 .data
1000 .edata
1000 .gfids
1000 .idata
1000 .pdata
7000 .rdata
1000 .reloc
B000 .text
2000 .xdata
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170424/4f89fd2c/attachment.html>
More information about the llvm-bugs
mailing list