Skip to content

preserve input section alignment - #59

Merged
katsyoshi merged 5 commits into
mainfrom
preserve-input-section-alignment
Aug 19, 2026
Merged

preserve input section alignment#59
katsyoshi merged 5 commits into
mainfrom
preserve-input-section-alignment

Conversation

@katsyoshi

@katsyoshi katsyoshi commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • preserve each input section's alignment while merging .text, .rodata, and .data
  • emit NOP padding for .text and zero padding for .rodata and .data
  • account for the synthetic _start prefix when aligning the first input .text contribution
  • propagate the maximum input sh_addralign and include padding in symbol and relocation offsets
  • apply aligned .data offsets to .rela.data relocations
  • distinguish defined entry-point symbols from undefined _start references
  • align the load bias for sections whose alignment exceeds the default load bias
  • add assembler fixtures plus Builder, Layout, and end-to-end integration coverage

Testing

  • bundle exec rake test — 58 tests, 260 assertions, 0 failures, 0 errors, 1 environment-dependent omission
  • bundle exec rake steep:check — no type errors

Manual testing

  • linked and ran an executable containing an 8 MiB-aligned .text section
  • confirmed that the output virtual address satisfies the section alignment while preserving the entry-point offset

The integration test links the aligned contributions with the self linker and verifies that the resulting executable exits with status 42.

@katsyoshi

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d91a455177

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/caotral/binary/elf/reader.rb
Comment thread lib/caotral/linker/builder.rb
@katsyoshi
katsyoshi force-pushed the preserve-input-section-alignment branch from d91a455 to 223dce4 Compare August 18, 2026 17:15
@katsyoshi

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dba0061a9e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/caotral/linker/builder.rb
Comment thread lib/caotral/linker/builder.rb
@katsyoshi

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: f61943dbc5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@katsyoshi
katsyoshi merged commit 8d75788 into main Aug 19, 2026
0 of 2 checks passed
@katsyoshi
katsyoshi deleted the preserve-input-section-alignment branch August 19, 2026 07:04
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.

1 participant