Using asm labels in function declaration produces unexpected bindings
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- backend-api-design, tooling
Research direction
Start by reading bindgen's handling of C function declarations and asm labels, then reproduce the provided syslog example with the stated bindgen version and compare the generated declarations. The issue does not name a source file or test; trace the parsing and code generation paths involved and add a regression test for the example. Done means the renamed function produces one binding instead of two.
Written by the indexing model from the issue text.
Description
gcc (and clang which I guess inherited the extension) allows a function to be declared with one name, but redirect calls to a function of a different name [1]. glibc makes heavy use of the feature to support multiple versions of long double on multiple targets. Some powerpc64le distros have switched the long double format, which turns on these awkward redirections.
A simplified and preprocessed example of syslog from syslog.h on powerpc64le on fedora 44 looks like:
extern void syslog (int __pri, const char *__fmt, ...);
extern __typeof (syslog) syslog __asm ("__syslogieee128");
Which produces the following from bindgen:
/* automatically generated by rust-bindgen 0.72.1 */
unsafe extern "C" {
pub fn syslog(__pri: ::std::os::raw::c_int, __fmt: *const ::std::os::raw::c_char, ...);
}
unsafe extern "C" {
#[link_name = "\u{1}__syslogieee128"]
pub fn syslog1(arg1: ::std::os::raw::c_int, arg2: *const ::std::os::raw::c_char, ...);
}
Ideally, there should be one binding to the renamed function. In this case, it's harmless as long as Rust does not support long double.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 846
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-lang/rust-bindgen
-
--enable-cxx-namespaces panics on namespace [[deprecated]] { ("[" is not a valid Ident)Possibly taken @lwz23 claimed this 47 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
rust-lang/rust-bindgen#3485 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rust-lang/rust-bindgen#3483 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
rust-lang/rust-bindgen#3370 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
rust-lang/rust-bindgen#3363 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
rust-lang/rust-bindgen#3540 ·
Maintainers usually reply within 1 day
All issues in rust-lang/rust-bindgen
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CakeRepository/agentshangout#995 ·
-
area:frontend kind:bug priority:p3 ready
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day