4f620ec5ee (master): [Bug #22401] addr2line.c: fall back to missing/crt_externs.h when the header is absent

1 view
Skip to first unread message

Dominik

unread,
5:35 AM (12 hours ago) 5:35 AM
to ruby...@g.ruby-lang.org
Dominik 2026-10-01 15:41:56 +0000 (Thu, 01 Oct 2026)

New Revision: 4f620ec5ee

https://github.com/ruby/ruby/commit/4f620ec5ee

Log:
[Bug #22401] addr2line.c: fall back to missing/crt_externs.h when the header is absent

The public iOS SDK does not ship crt_externs.h. addr2line.c included it
unconditionally and failed to compile:

addr2line.c:84:11: fatal error: 'crt_externs.h' file not found

hash.c, eval_intern.h and missing/setproctitle.c already handle this
case. They check HAVE_CRT_EXTERNS_H. When the header is absent, they
include missing/crt_externs.h instead. configure.ac sets that macro for
darwin targets, so the check works. addr2line.c was missed.

addr2line.c also calls _NSGetMachExecuteHeader(). Only the macOS
crt_externs.h declares that function. This commit declares it locally
when the header is absent. The declaration uses the LP() macro, which
selects mach_header or mach_header_64 for the pointer size. LP() was
defined inside fill_lines(), so this commit moves the definition to the
top of the file, next to the other Mach-O code. The symbol itself exists
in libSystem/dyld on iOS too.

macOS behavior does not change. On macOS HAVE_CRT_EXTERNS_H is defined,
so the includes and the declarations stay the same. The preprocessed
output is identical, apart from the __LINE__ numbers that the added
lines shift. LP() is not used before its new position, so the move
changes no other code.

Modified files:
addr2line.c
Reply all
Reply to author
Forward
0 new messages