Skip to content

Fix fragment padding size computation when output section is unaligned#358

Merged
quic-seaswara merged 1 commit intoqualcomm:mainfrom
parth-07:FragmentPaddingComputation
Oct 3, 2025
Merged

Fix fragment padding size computation when output section is unaligned#358
quic-seaswara merged 1 commit intoqualcomm:mainfrom
parth-07:FragmentPaddingComputation

Conversation

@parth-07
Copy link
Contributor

This commit fixes fragment padding size computation when output section address is unaligned. The fragment padding size computation (incorrectly) assumed that the fragment offset is congruent to the output section address (modulo fragment alignment). This assumption is violated when the output section address is explicitly specified in the linker script.

This change is causing UnalignedCrash.test to fail because the test expects the link to fail but now the link is passing. The link passing seems correct as both bfd/lld pass as well for this test case.

Resolves #346

@parth-07
Copy link
Contributor Author

parth-07 commented Aug 26, 2025

@quic-seaswara @quic-akaryaki I had to mark test/RISCV/standalone/Relaxation/UnalignedCrash/UnalignedCrash.test as UNSUPPORTED because the link in the test now passes whereas the test expects the link to fail. I think test passing is the correct behavior here because this test is passing with bfd and lld as well.

I tried to create a test case to check for Insufficient number of spare bytes for alignment relaxation error but was not able to create a test case for this. Can you please help me in creating a test case that would cause this error diagnostic?

@parth-07 parth-07 force-pushed the FragmentPaddingComputation branch from 4a0671a to b69f537 Compare August 26, 2025 19:16
@parth-07 parth-07 force-pushed the FragmentPaddingComputation branch 2 times, most recently from 95f9a85 to 54bbee7 Compare August 28, 2025 14:41
@parth-07 parth-07 requested a review from quic-seaswara August 28, 2025 14:53
@parth-07 parth-07 force-pushed the FragmentPaddingComputation branch 2 times, most recently from 3b4eab4 to fc3e9e0 Compare August 28, 2025 16:12
@parth-07 parth-07 force-pushed the FragmentPaddingComputation branch from fc3e9e0 to 9ec130e Compare August 28, 2025 19:32
@parth-07 parth-07 force-pushed the FragmentPaddingComputation branch 2 times, most recently from 0e891ba to fe994d7 Compare September 4, 2025 10:22
@parth-07 parth-07 force-pushed the FragmentPaddingComputation branch 2 times, most recently from 597b1fd to 7a44424 Compare September 22, 2025 15:11
@parth-07 parth-07 force-pushed the FragmentPaddingComputation branch 2 times, most recently from 4d996a0 to e23c6c3 Compare September 30, 2025 07:57
This commit fixes fragment padding size computation when output section
address is unaligned. The fragment padding size computation
(incorrectly) assumed that the fragment offset is congruent to the
output section address (modulo fragment alignment). This assumption is
violated when the output section address is explicitly specified in the
linker script.

This change is causing UnalignedCrash.test to fail because the test
expects the link to fail but now the link is passing. The link passing
seems correct as both bfd/lld pass as well for this test case.

Resolves qualcomm#346

Change-Id: I983658470b03583774593c4889a26dd6c7fff800
Signed-off-by: Parth Arora <partaror@qti.qualcomm.com>
@parth-07 parth-07 force-pushed the FragmentPaddingComputation branch from e23c6c3 to f33174d Compare October 3, 2025 06:59
@quic-seaswara quic-seaswara merged commit 0408d0a into qualcomm:main Oct 3, 2025
3 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.

map file shows improper section addresses

2 participants