Skip to content

'dlopen(null pointer)' does not work on the android #10356

Closed
@jaeminMoon

Description

@jaeminMoon

see rust/src/auxiliary/linkage-visibility.rs

#[no_mangle]
pub fn foo() { bar(); }

pub fn foo2<T>() {
    fn bar2() {
        bar();
    }
    bar2();
}

#[no_mangle]
fn bar() { }

#[no_mangle]
fn baz() { }

pub fn test() {
    let lib = DynamicLibrary::open(None).unwrap();
    unsafe {
        assert!(lib.symbol::<int>("foo").is_ok());
        assert!(lib.symbol::<int>("baz").is_err());
        assert!(lib.symbol::<int>("bar").is_err());
    }
}

This test code is success on linux, but fail on android.

 failed at 'assertion failed: lib.symbol::<int>("foo").is_ok()'

I think dlopen(null pointer, RTLD_LAZY) have to return 'main program Handle', but do not run on android.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-testsuiteArea: The testsuite used to check the correctness of rustcC-enhancementCategory: An issue proposing an enhancement or a PR with one.O-androidOperating system: AndroidT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions