PATCH: boehm-gc breakage between binutils 2.16.1 and 2.17 on FreeBSD [7.2]

Andrew Haley
Thu Sep 3 06:08:00 GMT 2009

Loren James Rittle wrote:
> (CCing java mailing list since main/only user of boehm-gc as in gcc tree.)
> I have submitted this patch (with minor modifications to adapt to
> changes in their line of development which are not present in gcc's
> copy of gc-6.6) against gc-7.2alpha2 (i.e. the upstream) where it has
> been accepted for inclusion in their next release.  In a nutshell:
> Problem: Static root registration fails on FreeBSD7+ when compiled
> with a gcc using binutils 2.17+ for a reason described in a FIXME
> comment in one version of GC_FirstDLOpenedLinkMap() in dyn_load.c.
> (And, unfortunately, the version of FirstDLOpenedLinkMap() used by all
> versions of FreeBSD without regard to their ability to use a better
> implementation. ;-)
> Solution: Enable the use of dl_iterate_phdr on those versions of
> FreeBSD that have it.  This patch was tested against the current gcc
> mainline@151279 bootstrapped to use GNU binutils 2.19.1 on FreeBSD 7.2
> and as bootstrapped to use the system linker (~2.15).
> First of all, I have seperated the macro check to decide whether we
> HAVE_DL_ITERATE_PHDR from the code enabled.  This simplifies adding
> checks for those systems (FYI, other non-linux, ELF systems besides
> FreeBSD would likely benefit from a similar change) that don't have
> the same complex glibc version dependencies.  Next, I add a check for
> the major version at which the FreeBSD system supports dl_iterate_phdr.
> OK, to commit to gcc mainline?
> Regards,
> Loren
> 2009-08-31  Loren J. Rittle  <>
> 	* dyn_load.c (HAVE_DL_ITERATE_PHDR): Break definition from use.
> 	Define for FreeBSD 7.0+.

This is fine.  It's definitely best to use dl_iterate_phdr where it works.
I presume that you've checked moving the definition of HAVE_DL_ITERATE_PHDR
doesn't break other systems.


More information about the Java mailing list