llvm-mingw icon indicating copy to clipboard operation
llvm-mingw copied to clipboard

Failed link exe use gnu ld

Open SquallATF opened this issue 5 years ago • 1 comments

I have tested my self build and llvm-mingw-20191230-x86_64.zip

test build command clang -fuse-ld=bfd h.c

error info

K:\llvm-mingw\bin\ld.bfd: K:\llvm-mingw\x86_64-w64-mingw32\lib\crt2.o: in function `pre_c_init':
/build/mingw-w64/mingw-w64-crt/build-x86_64/../crt/crtexe.c:(.text+0xa9): undefined reference to `__set_app_type'
K:\llvm-mingw\bin\ld.bfd: K:\llvm-mingw\x86_64-w64-mingw32\lib/libmingw32.a(lib64_libmingw32_a-charmax.o): in function `my_lconv_init':
/build/mingw-w64/mingw-w64-crt/build-x86_64/../crt/charmax.c:19: undefined reference to `__imp___lconv_init'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

sample code

int main() {
    return 0;
}

clang version

K:\>clang --version
clang version 10.0.0 (https://github.com/llvm/llvm-project.git c49194969430f0ee817498a7000a979a7a0ded03)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: K:\llvm-mingw\bin

ld version

K:\>llvm-mingw\bin\ld.bfd.exe --version
GNU ld (GNU Binutils) 2.33.1
Copyright (C) 2019 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

SquallATF avatar Feb 14 '20 09:02 SquallATF

I believe this is the same issue as I mentioned in passing in #17, that binutils doesn't seem to handle aliases in combination with msvc style import libraries. With ucrt, __set_app_type and __lconv_init are aliases for other imported functions.

mstorsjo avatar Feb 14 '20 09:02 mstorsjo