Skip to content

Native functions declared multiple times generate incorrect LLVM declarations #1161

Closed
@brson

Description

@brson
native "c-stack-cdecl" mod rustrt1 = "rustrt" {
    fn pin_task();
}

native "c-stack-cdecl" mod rustrt2 = "rustrt" {
    fn pin_task();
}

fn main() {
    rustrt1::pin_task();
    rustrt2::pin_task();
}
error: linking with gcc failed with code 1
note: gcc arguments: -L/home/brian/Dev/rust/build/stage1/lib/rustc/i686-unknown-linux-gnu/lib -m32 -o test/run-pass/native-dupe.stage1 test/run-pass/native-dupe.stage1.o -lrustrt -lm -lrustrt -lrt -ldl -Wl,-rpath,$ORIGIN/../../stage1/lib/rustc/i686-unknown-linux-gnu/lib -Wl,-rpath,/home/brian/Dev/rust/build/stage1/lib/rustc/i686-unknown-linux-gnu/lib -Wl,-rpath,/usr/local/lib/rustc/i686-unknown-linux-gnu/lib
note: /usr/bin/ld: test/run-pass/native-dupe.stage1.o: in function main::_8aa63318d6e05444:native-dupe.stage1(.text+0x69): error: undefined reference to 'pin_task1'
collect2: ld returned 1 exit status

error: aborting due to previous errors
rust: upcall fail 'explicit failure', ../src/comp/driver/session.rs:69
rust: domain main @0x8d37c78 root task failed

pin_task1 is not a real function

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions