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

Fix writing of aligned empty sections #540

Merged
merged 1 commit into from
May 9, 2023

Conversation

Amanieu
Copy link
Contributor

@Amanieu Amanieu commented May 2, 2023

This was previously causing an assertion failure because the alignment padding was not written to the buffer if the section was empty, which caused subsequent sections to be placed at the wrong offsets.

This was previously causing an assertion failure because the alignment
padding was not written to the buffer if the section was empty, which
caused subsequent sections to be placed at the wrong offsets.
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.

I assume this was broken by #514.

I think originally these zero length checks were meant to skip writing alignment for .bss sections, but it looks like both gcc and clang write this alignment, so LGTM.

@Amanieu
Copy link
Contributor Author

Amanieu commented May 2, 2023

I don't think this was broken by #514, it seems to be a separate issue. I only noticed because the debug_assert! was firing.

@philipc
Copy link
Contributor

philipc commented May 2, 2023

The test you added worked before #514.

@Amanieu
Copy link
Contributor Author

Amanieu commented May 2, 2023

Ah right I see it now. Yes this fixes the bug introduced by #514, while still keeping the new behavior of properly aligning empty sections.

@Amanieu
Copy link
Contributor Author

Amanieu commented May 8, 2023

Ping! Could this be merged and included in a release? It's currently breaking my code.

@philipc
Copy link
Contributor

philipc commented May 8, 2023

Yep, I'll get a release done this week.

@philipc philipc merged commit d58fa35 into gimli-rs:master May 9, 2023
@philipc
Copy link
Contributor

philipc commented May 10, 2023

Released in 0.31.1

mcbegamerxx954 pushed a commit to mcbegamerxx954/object that referenced this pull request Jun 15, 2024
This was previously causing an assertion failure because the alignment
padding was not written to the buffer if the section was empty, which
caused subsequent sections to be placed at the wrong offsets.
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

2 participants