Page MenuHomeFreeBSD

rtld: Switch to using <assert.h> for assert
ClosedPublic

Authored by jhb on Wed, Jan 14, 3:30 PM.
Tags
None
Referenced Files
F142366391: D54712.diff
Mon, Jan 19, 3:50 AM
Unknown Object (File)
Sat, Jan 17, 1:30 AM
Unknown Object (File)
Fri, Jan 16, 12:45 AM
Unknown Object (File)
Thu, Jan 15, 7:15 PM
Unknown Object (File)
Thu, Jan 15, 3:41 PM
Unknown Object (File)
Thu, Jan 15, 3:09 PM
Unknown Object (File)
Thu, Jan 15, 11:31 AM
Unknown Object (File)
Thu, Jan 15, 12:22 AM
Subscribers

Details

Summary

The stock assert() works because rtld-libc includes a custom
implementation of __assert().

Obtained from: CheriBSD
Sponsored by: AFRL, DARPA

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Wed, Jan 14, 3:30 PM

One consequence of this change is that NDEBUG will now disable assertions in rtld itself (and not just the bits of libc pulled into rtld-libc.a). Downstream in CheriBSD we #undef'd NDEBUG in debug.h, but I think honoring NDEBUG might be the better approach?

I'm agnostic on the NDEBUG issue, though have 'never disable assert' leanings. But just leanings, since performance is also important and I don't know the lay of the land here to have an informed opinion.

This revision is now accepted and ready to land.Wed, Jan 14, 3:34 PM
In D54712#1249886, @imp wrote:

I'm agnostic on the NDEBUG issue, though have 'never disable assert' leanings. But just leanings, since performance is also important and I don't know the lay of the land here to have an informed opinion.

We don't enable NDEBUG by default when building FreeBSD currently (MK_ASSERT_DEBUG defaults to yes), so you already have to opt into that for world.

No, this is not going to work. This brings stdio + locale into rtld.

In D54712#1249912, @kib wrote:

No, this is not going to work. This brings stdio + locale into rtld.

Even with the custom __assert() implementation in rtld-libc/rtld_libc.c?

This revision was automatically updated to reflect the committed changes.