[llvm-bugs] [Bug 49536] New: #pragma comment(lib) not ignored with MS extensions disabled
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Mar 11 05:59:24 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49536
Bug ID: 49536
Summary: #pragma comment(lib) not ignored with MS extensions
disabled
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: c.schaerf at t-online.de
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Even without MS extensions, Clang still follows the #pragma comment (lib)
directive.
According to the documentation [1], they should per default only be active on
Windows platforms. However, on Linux and even with -fno-ms-extensions
explicitly set, the directive is still followed.
The source code
#pragma comment(lib, "testlib.lib")
int main() {
return 0;
}
compiles to the following assembly:
.text
.file "test.cpp"
.globl main # -- Begin function main
.p2align 4, 0x90
.type main, at function
main: # @main
.cfi_startproc
# %bb.0:
xorl %eax, %eax
retq
.Lfunc_end0:
.size main, .Lfunc_end0-main
.cfi_endproc
# -- End function
.section .deplibs,"MS", at llvm_dependent_libraries,1
.ascii "testlib.lib"
.byte 0
.ident "clang version 13.0.0 (https://github.com/llvm/llvm-project
bc5e9ec2dccdd18f840a09fe63c196ae25ad99d5)"
.section ".note.GNU-stack","", at progbits
.addrsig
This behavior causes linker errors with LLD.
[1] https://clang.llvm.org/docs/UsersManual.html#microsoft-extensions
--
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/20210311/46d0831a/attachment-0001.html>
More information about the llvm-bugs
mailing list