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

Libunwind update + toolchain verification #228

Merged
merged 3 commits into from
May 4, 2020
Merged

Conversation

AdrianCX
Copy link
Contributor

Changes are needed to:

  1. Allow libunwind update.
  • We now have 4 symbols to reference start and size of sections .eh_frame and .eh_frame_hdr
  • We need to support previous versions as well.
  • Symbols are not reused from previous version to cause failure at compile time if old tool is used with new libunwind. (also added version check code to prevent this issue in the future and provide nice messages)
  1. Fail gracefully if toolchain version is unsupported (give user a nice message telling to update tools)

@jethrogb jethrogb requested a review from Pagten April 24, 2020 08:06
}

// According to entry.S in rust-lang 'desc - toolchain version number, 32-bit LE'
let version : u32 = ((desc[0] as u32) << 0) + ((desc[1] as u32) << 8) + ((desc[2] as u32) << 16) + ((desc[3] as u32) << 24);
Copy link
Contributor

Choose a reason for hiding this comment

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

You could write this as let version = u32::from_le_bytes(desc.try_into().unwrap());. The unwrap is justified by the check in line 200.

Copy link
Member

@Goirad Goirad Apr 24, 2020

Choose a reason for hiding this comment

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

Absolutely, definitely use that function instead of manually bitshifting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks

if let (Some(EH_FRM_HDR_BASE), Some(EH_FRM_HDR_SIZE)) = (syms.EH_FRM_HDR_BASE, syms.EH_FRM_HDR_SIZE) {
check_size!(EH_FRM_HDR_BASE == 8);
check_size!(EH_FRM_HDR_SIZE == 8);
}
Copy link
Member

Choose a reason for hiding this comment

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

Minor thing, but I believe it is standard practice to put the else on the same line as the closing bracket

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks

check_size!(EH_FRM_HDR_LEN == 8);
}
else {
bail!("Missing EH Frame header symbols, application must either have (EH_FRM_HDR_BASE/EH_FRM_HDR_SIZE) or (EH_FRM_OFFSET, EH_FRM_LEN, EH_FRM_HDR_OFFSET, EH_FRM_HDR_LEN");
Copy link
Member

Choose a reason for hiding this comment

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

I don't like that this message isn't more specific about what is missing, but I can't think of an elegant way of adding that specificity

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to improve on it, if you have other suggestions let me know

@jethrogb
Copy link
Member

jethrogb commented May 4, 2020

bors r=pagten

@bors
Copy link
Contributor

bors bot commented May 4, 2020

Build succeeded:

@bors bors bot merged commit 01d1d94 into master May 4, 2020
@AdrianCX AdrianCX mentioned this pull request May 5, 2020
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.

None yet

4 participants