Description
Hello
I was trying to build rustc target for thumbv7a-pc-windows-msvc locally, with a patch to compiler-builtins from this PR rust-lang/compiler-builtins#293, also hacked panic_unwind for thumbv7a similar to what we have for aarch64, https://github.com/rust-lang/rust/blob/master/src/libtest/lib.rs#L45, and I was able to build the target thumbv7a-pc-windows-msvc successfully, with below build command,
c:\python27\python.exe x.py build --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc --verbose
After the build I tried to use my private tool chain to build some other rust projects, e.g. iotedged-eventlog-messages, I received below build errors. I used a few different ways to merge artifacts from different stages
- use only stage1, does not even recognize thumbv7a
- copy stage2 over stage1, overwrite anything with same name that exists in stage1, I got below error
- the other way of bind's glue function should tail-call its target #2, same error.
Compiling iotedged-eventlog-messages v0.1.0 (D:\git\iotedge\edgelet\iotedged-eventlog-messages)
Running `rustc --edition=2018 --crate-name iotedged_eventlog_messages iotedged-eventlog-messages\src\lib.rs --color always --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C metadata=7b3a2d69b8dc278f --out-dir D:\git\iotedge\edgelet\target\thumbv7a-pc-windows-msvc\release\deps --target thumbv7a-pc-windows-msvc -L dependency=D:\git\iotedge\edgelet\target\thumbv7a-pc-windows-msvc\release\deps -L dependency=D:\git\iotedge\edgelet\target\release\deps -L all=D:\git\iotedge\edgelet\target\thumbv7a-pc-windows-msvc\release\build\iotedged-eventlog-messages-7acc25993b93c4f2\out -l event_messages.res`
error: linking with `link.exe` failed: exit code: 1120
|
= note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX64\\arm\\link.exe" "/NOLOGO" "/NXCOMPAT" "/OPT:NOLBR" "/LIBPATH:E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib" "D:\\git\\iotedge\\edgelet\\target\\thumbv7a-pc-windows-msvc\\release\\deps\\iotedged_eventlog_messages.iotedged_eventlog_messages.cr16zstb-cgu.0.rcgu.o" "/OUT:D:\\git\\iotedge\\edgelet\\target\\thumbv7a-pc-windows-msvc\\release\\deps\\iotedged_eventlog_messages.dll" "/DEF:C:\\Users\\chandde\\AppData\\Local\\Temp\\rustcLXLSml\\lib.def" "D:\\git\\iotedge\\edgelet\\target\\thumbv7a-pc-windows-msvc\\release\\deps\\iotedged_eventlog_messages.28a4ogesychbfxh1.rcgu.o" "/OPT:REF,ICF" "/DEBUG" "/LIBPATH:D:\\git\\iotedge\\edgelet\\target\\thumbv7a-pc-windows-msvc\\release\\deps" "/LIBPATH:D:\\git\\iotedge\\edgelet\\target\\release\\deps" "/LIBPATH:D:\\git\\iotedge\\edgelet\\target\\thumbv7a-pc-windows-msvc\\release\\build\\iotedged-eventlog-messages-7acc25993b93c4f2\\out" "/LIBPATH:E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib" "event_messages.res.lib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\libstd-67da064321eabc9f.rlib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\libpanic_abort-9adb8660ecc33a7a.rlib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\librustc_demangle-df85f75ef53673fc.rlib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\libhashbrown-9bd3a3fbf8f3ed5e.rlib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-edfd9642cc94109d.rlib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\libunwind-3ac22205e93ddd40.rlib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\liblibc-1287bf1fe4191b4b.rlib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\liballoc-822d54421becb1c7.rlib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\librustc_std_workspace_core-d51e26897332c0c9.rlib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\libcore-1fdb51d4e6dfea00.rlib" "E:\\rustc\\mixed2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib\\libcompiler_builtins-32eb33d96a637274.rlib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib" "/DLL" "/IMPLIB:D:\\git\\iotedge\\edgelet\\target\\thumbv7a-pc-windows-msvc\\release\\deps\\iotedged_eventlog_messages.dll.lib"
= note: Creating library D:\git\iotedge\edgelet\target\thumbv7a-pc-windows-msvc\release\deps\iotedged_eventlog_messages.dll.lib and object D:\git\iotedge\edgelet\target\thumbv7a-pc-windows-msvc\release\deps\iotedged_eventlog_messages.dll.exp
libstd-67da064321eabc9f.rlib(std-67da064321eabc9f.std.38mh430v-cgu.5.rcgu.o) : error LNK2019: unresolved external symbol __imp__ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E referenced in function _ZN3std3sys7windows7process7Command3new17hc990fb56302414eaE
libstd-67da064321eabc9f.rlib(std-67da064321eabc9f.std.38mh430v-cgu.12.rcgu.o) : error LNK2001: unresolved external symbol __imp__ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E
libstd-67da064321eabc9f.rlib(std-67da064321eabc9f.std.38mh430v-cgu.14.rcgu.o) : error LNK2001: unresolved external symbol __imp__ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E
libstd-67da064321eabc9f.rlib(std-67da064321eabc9f.std.38mh430v-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __imp__ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E
D:\git\iotedge\edgelet\target\thumbv7a-pc-windows-msvc\release\deps\iotedged_eventlog_messages.dll : fatal error LNK1120: 1 unresolved externals
error: aborting due to previous error
error: Could not compile `iotedged-eventlog-messages`.
Caused by:
process didn't exit successfully: `rustc --edition=2018 --crate-name iotedged_eventlog_messages iotedged-eventlog-messages\src\lib.rs --color always --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C metadata=7b3a2d69b8dc278f --out-dir D:\git\iotedge\edgelet\target\thumbv7a-pc-windows-msvc\release\deps --target thumbv7a-pc-windows-msvc -L dependency=D:\git\iotedge\edgelet\target\thumbv7a-pc-windows-msvc\release\deps -L dependency=D:\git\iotedge\edgelet\target\release\deps -L all=D:\git\iotedge\edgelet\target\thumbv7a-pc-windows-msvc\release\build\iotedged-eventlog-messages-7acc25993b93c4f2\out -l event_messages.res` (exit code: 1)
I did some rough check in the thumbv7a liballoc library, interestingly, the name mangling for EMPTY_ROOT_NODE is different than most of others. The symbol wanted is __imp__ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E
, however the one that I have in the thumbv7a lib is __imp___ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E
, note there are 2 underscores in the wanted symbol and 3 underscores in the actual symbol. that's because I have this symbol _ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h486b4088caeaa846E
which already starts with an underscore
Looking at other symbols in the same lib, none of them start with a single underscore, e,g, anon.6bd877021c225a724ec59609200b96d6.6.llvm.13430696783672607638
and __imp__anon.6bd877021c225a724ec59609200b96d6.2.llvm.13430696783672607638
.
I have no idea why the toolchain is looking for __imp__
for EMPTY_ROOT_NODE instead of looking for __imp___
Thoughts?