Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lld-link should have a better diag on missing main / WinMain, probably by defaulting to the subsystem-specific entry point even if main isn't there #38320

Closed
nico opened this issue Sep 16, 2018 · 1 comment
Labels
bugzilla Issues migrated from bugzilla lld:COFF

Comments

@nico
Copy link
Contributor

nico commented Sep 16, 2018

Bugzilla Link 38972
Resolution FIXED
Resolved on Oct 03, 2018 10:05
Version unspecified
OS All
Blocks #38315

Extended Description

If main is missing in link.exe, it prints:

FAILED: test_process.exe test_process.exe.pdb
cmd /c C:/b/depot_tools/win_tools-2_7_6_bin/python/bin/python.exe ../../build/toolchain/win/tool_wrapper.py delete-file ./test_process.exe.pdb && C:/b/depot_tools/win_tools-2_7_6_bin/python/bin/python.exe ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x86 False link.exe /nologo /OUT:./test_process.exe /PDB:./test_process.exe.pdb @./test_process.exe.rsp
libcmt.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int __cdecl __scrt_common_main_seh(void)" (?__scrt_common_main_seh@@yahxz)

lld-link prints:

FAILED: test_process.exe test_process.exe.pdb
ninja -t msvc -e environment.x86 -- ../../third_party/llvm-build/Release+Asserts/bin/lld-link.exe /nologo /OUT:./test_process.exe /PDB:./test_process.exe.pdb @./test_process.exe.rsp
lld-link: error: entry point must be defined

"entry point" is less understandable than "missing _main" for most developers; lld-link should have a better diag.

@nico
Copy link
Contributor Author

nico commented Oct 3, 2018

r343698 made lld-link's output similar to link.exe's:

lld-link: error: undefined symbol: _main

referenced by f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78
libcmt.lib(exe_main.obj):("int __cdecl invoke_main(void)" (?invoke_main@@yahxz))
referenced by f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283
libcmt.lib(exe_main.obj):("int __cdecl __scrt_common_main_seh(void)" (?__scrt_common_main_seh@@yahxz))

Good enough for now

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla lld:COFF
Projects
None yet
Development

No branches or pull requests

1 participant