Skip to content

Libexec/rtld freebsd noinit#356

Merged
laffer1 merged 2 commits into
masterfrom
libexec/rtld-freebsd-noinit
May 15, 2026
Merged

Libexec/rtld freebsd noinit#356
laffer1 merged 2 commits into
masterfrom
libexec/rtld-freebsd-noinit

Conversation

@laffer1
Copy link
Copy Markdown
Member

@laffer1 laffer1 commented May 15, 2026

Summary by Sourcery

Update runtime linker ELF note handling and enable additional SQLite3 features.

New Features:

  • Enable SQLite3 preupdate hook support.
  • Expose SQLite3 column metadata queries.

Bug Fixes:

  • Recognize both MidnightBSD and FreeBSD vendor note sizes when parsing ELF ABI and NOINIT notes in the runtime linker.

Enhancements:

  • Clarify the NOINIT ELF note comment to indicate support for both FreeBSD and MidnightBSD.

laffer1 added 2 commits May 8, 2026 13:40
SQLITE_ENABLE_SESSION alone is insufficient; SQLite's documentation
requires SQLITE_ENABLE_PREUPDATE_HOOK to be defined alongside it for
the session/changeset/patchset API (sqlite3session_*, sqlite3changeset_*)
to be fully functional.

SQLITE_ENABLE_COLUMN_METADATA enables sqlite3_column_origin_name(),
sqlite3_column_database_name(), and sqlite3_column_table_name(), which
Node.js 24 and other consumers depend on.

AI-Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Lucas Holt <luke@foolishgames.com>
Accept FreeBSD note vendor sizing when parsing ELF notes so FreeBSD binaries carrying NT_FREEBSD_NOINIT_TAG set crt_no_init. This lets rtld run the main executable init arrays instead of leaving C++ globals uninitialized.

AI-Assisted-by: Codex <noreply@openai.com>
Signed-off-by: Lucas Holt <luke@foolishgames.com>
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 15, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Extends rtld’s ELF note parsing to recognize a FreeBSD vendor note for the no-init CRT tag, and enables additional SQLite3 features via build flags.

Flow diagram for rtld ELF no-init note handling

flowchart TD
    A[digest_notes receives ELF note] --> B{Vendor size matches
NOTE_MIDNIGHTBSD_VENDOR or NOTE_FREEBSD_VENDOR
and desc size matches int32_t}
    B -- no --> C[Skip note]
    B -- yes --> D{note->n_type}
    D -- NT_MIDNIGHTBSD_NOINIT_TAG --> E[obj->crt_no_init = true]
    D -- other --> F[Handle other supported tags]
    E --> G[Continue scanning notes]
    F --> G[Continue scanning notes]
    C --> G
Loading

File-Level Changes

Change Details Files
Update rtld ELF note handling to treat FreeBSD vendor notes like MidnightBSD for ABI and no-init tags.
  • Relax vendor-name size check in digest_notes to accept both MidnightBSD and FreeBSD vendor note names when processing ELF ABI-related notes.
  • Clarify the comment for the NT_MIDNIGHTBSD_NOINIT_TAG handler to indicate it applies to both FreeBSD and MidnightBSD while still setting crt_no_init.
libexec/rtld-elf/rtld.c
Enable extra SQLite features at build time.
  • Add SQLITE_ENABLE_PREUPDATE_HOOK to CFLAGS to allow use of the SQLite pre-update hook API.
  • Add SQLITE_ENABLE_COLUMN_METADATA to CFLAGS to expose column metadata functionality.
lib/libsqlite3/Makefile

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@laffer1 laffer1 merged commit fe70e94 into master May 15, 2026
4 of 10 checks passed
@laffer1 laffer1 deleted the libexec/rtld-freebsd-noinit branch May 15, 2026 22:20
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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