Page MenuHomeFreeBSD

Allow bootstrapping localdef on non-FreeBSD systems
ClosedPublic

Authored by arichardson on Jun 11 2020, 10:24 AM.

Details

Summary

The current localdef simply assumes that the locale headers on build system
are compatible with those on the target system which is not necessarily true.
It generally works on FreeBSD (as long as we don't change the locale headers),
but Linux and macOS provide completely different locale headers.

This change adds new bootstrap headers that namespace certain xlocale
structures defined or used by in the headers that localdef needs.
This is required since system headers *must* be able to include the "real"
locale headers for printf(), etc., but we also want to access the target
systems's internal locale structures.

Test Plan

compiles and we have been using a similar diff in CheriBSD for a long time.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

arichardson created this revision.

Not sure what arc did here with copied from. Those are new files not copies.

I think this looks good.

This revision is now accepted and ready to land.Jun 18 2020, 4:04 PM

New approach that avoids modifying public headers

This revision now requires review to proceed.Jun 30 2020, 11:38 AM
arichardson edited the test plan for this revision. (Show Details)
arichardson added reviewers: brooks, jhb.

avoid unncessary diff to makefile

collate.c looks like an independent bugfix you can just commit first?

usr.bin/localedef/collate.c
855 ↗(On Diff #73905)

could add the space after , here and below while you're changing it

approach seems reasonable to me

collate.c looks like an independent bugfix you can just commit first?

Sounds good. I'll commit those changes seprately from the cross-build changes.

usr.bin/localedef/bootstrap/namespace.h
40 ↗(On Diff #73905)

I will fix the names of these macros to use localedef_bootstrap before committing.

If no one objects I'll commit this patch later this week.

One small typo, but otherwise looks good.

usr.bin/localedef/bootstrap/bootstrap_xlocale_private.h
44 ↗(On Diff #73905)

s/th/the/

This revision is now accepted and ready to land.Jul 14 2020, 5:38 PM