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 GNU Property Types #537

Merged
merged 1 commit into from
Apr 25, 2023
Merged

Add GNU Property Types #537

merged 1 commit into from
Apr 25, 2023

Conversation

cchiw
Copy link
Contributor

@cchiw cchiw commented Apr 20, 2023

Adds GNU Property Type constants.

We are using them in Rust PR to emit notes.
A previous CL added a property constant CL.

@philipc
Copy link
Contributor

philipc commented Apr 21, 2023

let pr_data: u32 = 3; // Program property descriptor

Can you add constants for this value as well (it appears to be architecture specific, for example GNU_PROPERTY_X86_FEATURE_1_IBT | GNU_PROPERTY_X86_FEATURE_1_SHSTK).

let pr_padding: u32 = 3;

It seems unusual to have a non-zero value for padding.

@cchiw
Copy link
Contributor Author

cchiw commented Apr 21, 2023

let pr_data: u32 = 3; // Program property descriptor

Can you add constants for this value as well (it appears to be architecture specific, for example GNU_PROPERTY_X86_FEATURE_1_IBT | GNU_PROPERTY_X86_FEATURE_1_SHSTK).

yup, done.

let pr_padding: u32 = 3;

It seems unusual to have a non-zero value for padding.
I changed it to 0 and it works. Thank you.

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!

@@ -3,7 +3,7 @@ name = "object"
version = "0.31.0"
edition = "2018"
exclude = ["/.github", "/testfiles"]
keywords = ["object", "elf", "mach-o", "pe", "coff", "xcoff"]
keywords = ["object", "elf", "mach-o", "pe", "coff"]
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, it looks like you squashed your commit into one of the existing commits.

@philipc philipc merged commit a68cfc5 into gimli-rs:master Apr 25, 2023
/// GNU Property Type for BTI AArch64
pub const GNU_PROPERTY_AARCH64_FEATURE_1_BTI: u32 = 1 << 0;
/// GNU Property Type for PAC AArch64
pub const GNU_PROPERTY_AARCH64_FEATURE_1_PAC: u32 = 1 << 0;

Choose a reason for hiding this comment

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

https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/BinaryFormat/ELF.h#L1675 shows that there is a typo here. It should be 1 << 1 instead of a duplicate 1 << 0. Should I upload a fix?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for noticing that. I plan to do further work in this area and I'll fix that at the same time.

@cchiw
Copy link
Contributor Author

cchiw commented May 8, 2023

Hi, I want to learn more about how crates get updated. When can we expect this code to be merged into upstream Rust?

@philipc
Copy link
Contributor

philipc commented May 9, 2023

For non-breaking changes, I do a release as needed. For breaking changes, I like to delay if possible since it causes other crates to need to update and do a release too.

I'm in the process of doing a release now: #546. Since there aren't any breaking changes, it should be trivial to use this in upstream Rust.

Also, in #541 I did some further work related to this PR which may interest you.

@philipc
Copy link
Contributor

philipc commented May 10, 2023

Released in 0.31.1

@cchiw
Copy link
Contributor Author

cchiw commented May 15, 2023

Cool! I'm going to try to incorporate this in and work on a PR. Unless you already had one started?

@philipc
Copy link
Contributor

philipc commented May 15, 2023

There's already rust-lang/rust#111413 for updating object.

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jul 12, 2023
Use constants from object crate

Replace hard-coded values with  `GNU_PROPERTY_{X86|AARCH64}_FEATURE_1_AND` from the object crate.

When working on  [issue](rust-lang#103001) it was suggested that we moved these constants to the object crate .  [PR](gimli-rs/object#537). Now that that the object crate has been updated  [PR](rust-lang#111413) we can make this change.
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jul 12, 2023
Use constants from object crate

Replace hard-coded values with  `GNU_PROPERTY_{X86|AARCH64}_FEATURE_1_AND` from the object crate.

When working on  [issue](rust-lang#103001) it was suggested that we moved these constants to the object crate .  [PR](gimli-rs/object#537). Now that that the object crate has been updated  [PR](rust-lang#111413) we can make this change.
mcbegamerxx954 pushed a commit to mcbegamerxx954/object that referenced this pull request Jun 15, 2024
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.

4 participants