Page MenuHomeFreeBSD

Remove eprintf - it was needed only for ancient GCC assert.h
ClosedPublic

Authored by emaste on May 20 2015, 2:26 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 11:29 AM
Unknown Object (File)
Fri, Nov 1, 7:18 AM
Unknown Object (File)
Fri, Oct 18, 6:41 AM
Unknown Object (File)
Wed, Oct 16, 6:31 AM
Unknown Object (File)
Wed, Oct 16, 6:31 AM
Unknown Object (File)
Wed, Oct 16, 6:31 AM
Unknown Object (File)
Wed, Oct 16, 6:00 AM
Unknown Object (File)
Oct 5 2024, 8:44 AM
Subscribers

Details

Summary

As far as I can tell:

  • Prior to 2001 GCC used to provide its own assert.h
  • The GCC assert.h required __eprintf to emit the error message
  • FreeBSD's own assert.h never used this

so objects with references to __eprintf must have been compiled with a 15 year old GCC other than the one in the base system. I'm not sure we need to worry about that.

This came up because __eprintf references __stderrp, compilerrt_mumble, fflush and fprintf. This doesn't matter much when used as libgcc.a, although introduces a small additional link-time overhead for probably no value.

I would like to extend compiler-rt to libgcc_s.so as well, and this dependency seems silly there (even if in practice it will not be a problem).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 50360

Event Timeline

emaste retitled this revision from to Remove eprintf - it was needed only for ancient GCC assert.h.
emaste updated this object.
emaste edited the test plan for this revision. (Show Details)
emaste added a reviewer: ed.
emaste set the repository for this revision to rS FreeBSD src repository - subversion.
ed edited edge metadata.
This revision is now accepted and ready to land.May 20 2015, 7:08 AM
ed removed a reviewer: ed.
This revision now requires review to proceed.Aug 2 2015, 9:58 AM

From contrib/llvm-project/compiler-rt/lib/builtins/eprintf.c:

// __eprintf() was used in an old version of <assert.h>.
// It can eventually go away, but it is needed when linking
// .o files built with the old <assert.h>.
//
// It should never be exported from a dylib, so it is marked
// visibility hidden.
imp accepted this revision.EditedMar 14 2023, 5:10 PM

Yea, we don't necessarily promise compatibility for this, but we could add it to a compatX if there's demand
[edited]

This revision is now accepted and ready to land.Mar 14 2023, 5:10 PM

The comment in the compiler-rt implementation indicates it was only used for static linking, so this would only come up if you tried to build something on modern FreeBSD with a 20-year-old GCC.

Or had a .o compiled with a 20+ year old GCC that was not the one in the FreeBSD base system.

This revision was automatically updated to reflect the committed changes.