Skip to content

Incorrect link_name is generated for extern "C" functions for 32 bit linux #904

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

Closed
chengchangwu opened this issue Aug 11, 2017 · 4 comments

Comments

@chengchangwu
Copy link

Like #728, but for 32 bit Linux.

Input C/C++ Header

struct ec_sdo_request;
typedef struct ec_sdo_request ec_sdo_request_t;
int *ecrt_sdo_request_data(
        ec_sdo_request_t *req /**< SDO request. */
        );

Bindgen Invocation

$ bindgen input.h

Actual Results

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ec_sdo_request {
    _unused: [u8; 0],
}
pub type ec_sdo_request_t = ec_sdo_request;
extern "C" {
    #[link_name = "_Z21ecrt_sdo_request_data"]
    pub fn ecrt_sdo_request_data(req: *mut ec_sdo_request_t)
     -> *mut ::std::os::raw::c_int;
}

Expected Results

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ec_sdo_request {
    _unused: [u8; 0],
}
pub type ec_sdo_request_t = ec_sdo_request;
extern "C" {
    pub fn ecrt_sdo_request_data(req: *mut ec_sdo_request_t)
     -> *mut ::std::os::raw::c_int;
}
@emilio
Copy link
Contributor

emilio commented Aug 11, 2017

Which clang version is this?

@emilio
Copy link
Contributor

emilio commented Aug 11, 2017

This sounds like #528

@chengchangwu
Copy link
Author

I've clang-3.8, clang-3.9 and and old libclang1-3.6 installed. After removing clang-3.8 and old libclang1-3.6, the problem is fixed.

Thanks.

@emilio
Copy link
Contributor

emilio commented Aug 11, 2017

Closed as a dupe of #528 then, thanks for checking!

There's a workaround explained there.

@emilio emilio closed this as completed Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants