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

write/coff: Set checksum for BSS section symbols #718

Merged
merged 3 commits into from
Aug 11, 2024

Conversation

OndrikB
Copy link
Contributor

@OndrikB OndrikB commented Aug 10, 2024

Some compilers generate section symbols for the BSS section, which is then used with relocations in other sections.
This causes a panic on the current version since the checksum is done on section.data(), which fails the assertion !self.is_bss().
With this, I am setting the checksum of a BSS section to 0, which it is also set to with the compiler I am using.

@OndrikB OndrikB marked this pull request as draft August 10, 2024 19:27
I am extremely sorry, this is my first time really contributing to such a project.
@OndrikB OndrikB marked this pull request as ready for review August 10, 2024 19:29
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! This looks correct.

Can you add a test for this in tests/round_trip/bss.rs. It should be enough to modify the coff_x86_64_bss test to call object.section_symbol(section); and then check that we read back a section symbol.

@OndrikB
Copy link
Contributor Author

OndrikB commented Aug 11, 2024

Added the test now. Since I'm not entirely sure about how section symbols are handled, I decided to add it as the first one before the 2 other symbols.

@OndrikB OndrikB requested a review from philipc August 11, 2024 13:17
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 112417e into gimli-rs:master Aug 11, 2024
10 checks passed
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.

2 participants