[GR-50985] Set alignment to 1 for Java DWARF debug info sections #8046
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 asnewDebugSection
method already has a comment on this exact issue:See ##4574 for more insight.