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

[GR-50985] Set alignment to 1 for Java DWARF debug info sections #8046

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

esytnik
Copy link
Contributor

@esytnik esytnik commented Dec 18, 2023

This PR addresses cases when GraalVM sometimes generates corrupted debug info by ensuring that debug sections have alignment set to 1.

Current we mistakenly generate debug info sections with alignment of 8 (for 64-bit OS) and this causes linker to generate corrupt debug info when it has several object files with debug info with different alignment. For example on Alpine Linux crt1.o and crti.o libraries have debug information section with alignment of 1. Linker writes those sections first and then pads to alignment of 8 before processing Graal-generated debug info section because it has alignment of 8.

Evidently calling newUserDefinedSection was an oversight as newDebugSection method already has a comment on this exact issue:

                                 // debugging information is mostly unaligned; padding can result in
                                 // corrupted data when the linker merges multiple debugging
                                 // sections from different inputs

See ##4574 for more insight.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 18, 2023
@adinn
Copy link
Collaborator

adinn commented Dec 18, 2023

Doh! Thank you for spotting this @esytnik !

@adinn
Copy link
Collaborator

adinn commented Dec 18, 2023

@olpaw @fniephaus Could you approve the workflow to check this patch and also help review and commit it?

@adinn
Copy link
Collaborator

adinn commented Dec 18, 2023

It should fix the problem reported in #4574

Copy link
Member

@fniephaus fniephaus left a comment

Choose a reason for hiding this comment

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

LGTM

@esytnik
Copy link
Contributor Author

esytnik commented Dec 18, 2023

It should fix the problem reported in #4574

as well as #3452

@fniephaus fniephaus changed the title Set alignment to 1 for Java DWARF debug info sections [GR-50985] Set alignment to 1 for Java DWARF debug info sections Dec 18, 2023
@graalvmbot graalvmbot merged commit 1b59f41 into oracle:master Dec 19, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants