While testing raw-dylib support against nightly-i686-pc-windows-gnu I noticed that it would fail with a cryptic error.
Here's a minimal repro: https://github.com/kennykerr/repro-raw-dylib
#![feature(raw_dylib)]
#![feature(native_link_modifiers_verbatim)]
#[link(name = "kernel32.dll", kind = "raw-dylib", modifiers = "+verbatim", import_name_type = "undecorated")]
extern "stdcall" {
fn LoadLibraryA(name: *const u8) -> isize;
}
#[test]
fn test() {
assert_ne!(0, unsafe { LoadLibraryA("kernel32.dll\0".as_ptr()) });
}
This compiles and runs cleanly i686-pc-windows-msvc but fails on i686-pc-windows-gnu with the following error:
error: assembler label 'LoadLibraryA' can not be undefined
rust version 1.67.0-nightly (e631891f7 2022-11-13)
@dpaoliello pointed out that it seems that if we have an undecorated symbol that begins with 'L' (yep) then LLVM assumes that it is an assembler label, hence the error.
While testing
raw-dylibsupport againstnightly-i686-pc-windows-gnuI noticed that it would fail with a cryptic error.Here's a minimal repro: https://github.com/kennykerr/repro-raw-dylib
This compiles and runs cleanly
i686-pc-windows-msvcbut fails oni686-pc-windows-gnuwith the following error:@dpaoliello pointed out that it seems that if we have an undecorated symbol that begins with 'L' (yep) then LLVM assumes that it is an assembler label, hence the error.