Skip to content
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

Add basic support for x86_32 architecture #320

Merged
merged 2 commits into from
Jun 3, 2021

Conversation

alexcrichton
Copy link
Contributor

This corresponds to the Rust x86_64-unknown-linux-gnux32 target,
notably that the architecture listed is x86_64 but the word size is 32

@bjorn3
Copy link
Contributor

bjorn3 commented Jun 3, 2021

x32 may be dropped from the Linux kernel in the future: https://lkml.org/lkml/2018/12/10/1145

@philipc
Copy link
Contributor

philipc commented Jun 3, 2021

I prefer if the minimum support added is enough to pass the test at

fn elf_any() {

This corresponds to the Rust `x86_64-unknown-linux-gnux32` target,
notably that the architecture listed is x86_64 but the word size is 32
@alexcrichton
Copy link
Contributor Author

Certainly! Some small testing locally appeared that relocations for x86_32 are encoded in the same way as x86_64, although I am not certain about this. Do you know of a location to confirm that?

@philipc
Copy link
Contributor

philipc commented Jun 3, 2021

LLVM agrees with that: https://github.com/llvm/llvm-project/blob/e712a92b8fe706c4a736748af324382850d1515c/llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp#L334-L339

Also, I'm not sure that x86_32 is the correct name for this; to me, that is the same as i386. I've seen this referred to as x32, but I don't know what the target triple uses. Edit: you gave the target triple..

@alexcrichton
Copy link
Contributor Author

Yeah I seem to see a lot of various names, but presumably keeping "x32" somewhere in the name is most reasonable? Maybe X32 alone? Or X86_64_X32 (although that's a mouthful...)? Or just X86_X32?

@philipc
Copy link
Contributor

philipc commented Jun 3, 2021

Let's go with X86_64_X32. The architecture really is X86_64, but the problem is we're assuming the address size from the architecture, which is convenient for most cases but doesn't work here.

@alexcrichton
Copy link
Contributor Author

Sounds good! Pushed up

Copy link
Contributor

@philipc philipc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@philipc philipc merged commit 74dbb85 into gimli-rs:master Jun 3, 2021
@alexcrichton alexcrichton deleted the more-arch branch June 3, 2021 22:55
mcbegamerxx954 pushed a commit to mcbegamerxx954/object that referenced this pull request Jun 15, 2024
This corresponds to the Rust `x86_64-unknown-linux-gnux32` target,
notably that the architecture listed is x86_64 but the word size is 32
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

Successfully merging this pull request may close these issues.

3 participants