Skip to content

Commit fe70e94

Browse files
authored
Libexec/rtld freebsd noinit (#356)
* lib/libsqlite3: enable PREUPDATE_HOOK and COLUMN_METADATA 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> * rtld: honor FreeBSD no-init notes 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> --------- Signed-off-by: Lucas Holt <luke@foolishgames.com>
1 parent 68a2b29 commit fe70e94

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/libsqlite3/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ CFLAGS+= -I${SQLITE} \
3737
-DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_FTS4 \
3838
-DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY \
3939
-DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_MATH_FUNCTIONS \
40-
-DSQLITE_ENABLE_SESSION
40+
-DSQLITE_ENABLE_SESSION \
41+
-DSQLITE_ENABLE_PREUPDATE_HOOK \
42+
-DSQLITE_ENABLE_COLUMN_METADATA
4143

4244
MK_MAN= no
4345

libexec/rtld-elf/rtld.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,8 @@ digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_Addr note_end)
17701770
note = (const Elf_Note *)((const char *)(note + 1) +
17711771
roundup2(note->n_namesz, sizeof(Elf32_Addr)) +
17721772
roundup2(note->n_descsz, sizeof(Elf32_Addr)))) {
1773-
if (note->n_namesz != sizeof(NOTE_MIDNIGHTBSD_VENDOR) ||
1773+
if ((note->n_namesz != sizeof(NOTE_MIDNIGHTBSD_VENDOR) &&
1774+
note->n_namesz != sizeof(NOTE_FREEBSD_VENDOR)) ||
17741775
note->n_descsz != sizeof(int32_t))
17751776
continue;
17761777
if (note->n_type != NT_FREEBSD_ABI_TAG &&
@@ -1802,7 +1803,7 @@ digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_Addr note_end)
18021803
dbg("note fctl0 %#x", obj->fctl0);
18031804
break;
18041805
case NT_MIDNIGHTBSD_NOINIT_TAG:
1805-
/* MidnightBSD 'crt does not call init' note */
1806+
/* FreeBSD/MidnightBSD 'crt does not call init' note */
18061807
obj->crt_no_init = true;
18071808
dbg("note crt_no_init");
18081809
break;

0 commit comments

Comments
 (0)