Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Mar 2015 12:12:32 -0500
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        Greg Lewis <glewis@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, alc@rice.edu, alc@FreeBSD.org, Don Lewis <truckman@FreeBSD.org>, clusteradm@FreeBSD.org, svn-src-head@FreeBSD.org, portmgr@FreeBSD.org, Konstantin Belousov <kostikbel@gmail.com>, svn-src-all@FreeBSD.org
Subject:   Re: svn commit: r280327 - in head/sys: kern vm
Message-ID:  <55198400.1040300@FreeBSD.org>
In-Reply-To: <20150330091209.GC2379@kib.kiev.ua>
References:  <5516EB31.7000309@rice.edu> <201503300625.t2U6PE3c093114@gw.catspoiler.org> <20150330091209.GC2379@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--14QWRO38hCII64m64PCAsdf7M83WdKwCG
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

On 3/30/2015 4:12 AM, Konstantin Belousov wrote:
> On Sun, Mar 29, 2015 at 11:25:14PM -0700, Don Lewis wrote:
>> On amd64, with an amd64 jail, and kernel rev r280326, I observe the
>> following:
>> 	One gcc process calls mmap() with addr=3D0 and len=3D0x657a000, and
>>         the value 0x811400000 is returned.  Subsequent gcc processes
>>         call mmap() with addr=3D0x811400000 and len=3D0x657a000, getti=
ng
>>         0x811400000 in return.
>>
>> With kernel rev r280327 I see:
>> 	One gcc process calls mmap() with addr=3D0 and len=3D0x657a000, and
>> 	the value 0x811400000 is returned.  Subsequent gcc processes
>> 	call mmap() with addr=3D0x811400000 and len=3D0x657a000, getting
>> 	0x8115f4000 in return.  What I later noticed is that the subsequent
>> 	calls are passing offset=3D0x1f4000.  Not so coincidentally,
>> 	0x811400000 + 0x1f4000 =3D 0x8115F4000.
>>
>> My first attempt at a fix subtracted offset from address, but the mmap=
()
>> return value changed to 0x8113f4000 instead of the 0x811400000 I was
>> expecting.  It looked to me like the code must be doing superpage
>> alignment on the start of the file and then adding the offset to get t=
he
>> start of the mapped region.
> So the real fix is to make gcc pass MAP_FIXED.
>=20
>>
>> This somewhat hacking patch disables this alignment if a non-zero
>> address is passed as a hint, and allows the code to make the start of
>> the mapped region match the hint.  With this patch, I've been able to
>> build openjdk7 in a FreeBSD 9.3 amd64 jail.
>>
> This is for precompiled headers, right ?  Could port disable pch ?
>=20

That is my opinion as well but I don't think it is enough.

This gcc issue is quite old. Here is a 2004 reference for a similar
issue on Cygwin. https://gcc.gnu.org/ml/gcc-bugs/2004-05/msg00559.html

I think it is not enough to disable PCH in openjdk7. I am finding the
"had to relocate PCH" error referenced in many other ports. I have ran
into it randomly before as well.

I think what we need to do is:

1. Fix GCC on head to use MAP_FIXED
2. Fix GCC ports to all use MAP_FIXED
3. Force ports that use PCH builds to use the port GCC or clang and not
the base GCC in all releases.

This patch should fix openjdk7 for now. My test build is still running.

~/svn/ports/java/openjdk7 # svn diff
Index: Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Makefile    (revision 382519)
+++ Makefile    (working copy)
@@ -26,7 +26,7 @@

 WRKSRC=3D                ${WRKDIR}/${PORTNAME}

-USES=3D          dos2unix iconv gmake zip
+USES=3D          compiler:features dos2unix iconv gmake zip
 USE_XORG+=3D     x11 xext xi xrender xt xtst
 MAKE_ARGS=3D     CC=3D${CC:Q} CXX=3D${CXX:Q} HOST_CC=3D${CC:Q}

@@ -125,6 +125,10 @@

 .include <bsd.port.pre.mk>

+.if ${COMPILER_TYPE} !=3D clang
+MAKE_ENV+=3D     USE_PRECOMPILED_HEADER=3D0
+.endif
+
 .if empty(ICONV_LIB)
 MAKE_ENV+=3D     EXTRA_CFLAGS=3D-DLIBICONV_PLUG
 .endif
Index: files/patch-bsd
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- files/patch-bsd     (revision 382519)
+++ files/patch-bsd     (working copy)
@@ -184,16 +184,12 @@
  # version 4 and above support fvisibility=3Dhidden (matches jni_x86.h f=
ile)
  # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
  ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \(
$(CC_VER_MAJOR) =3D 4 \) \& \( $(CC_VER_MINOR) \>=3D 3 \) \))" "0"
-@@ -215,7 +218,11 @@
+@@ -215,7 +218,7 @@

  # Flags for generating make dependency flags.
  ifneq ("${CC_VER_MAJOR}", "2")
 -DEPFLAGS =3D -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=3D%.d)
-+DEPFLAGS =3D
-+ifeq (,$(findstring clang,$(shell $(CC) -v 2>&1)))
-+DEPFLAGS +=3D -fpch-deps
-+endif
-+DEPFLAGS +=3D -MMD -MP -MF $(DEP_DIR)/$(@:%=3D%.d)
++DEPFLAGS =3D -MMD -MP -MF $(DEP_DIR)/$(@:%=3D%.d)
  endif

  # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in
precompiled.hpp.


--=20
Regards,
Bryan Drewery


--14QWRO38hCII64m64PCAsdf7M83WdKwCG
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJVGYQAAAoJEDXXcbtuRpfPQ6YIAK+HCvHgzKHT1YLsHQ1YyNHa
ZkLkftkIau6QsZMSqj5RvfiqqZbvESxCBd6snhWwpPaHjLJAg/Aw8Tz4nBuVADht
iT8scJMrZw1JbyFmjYTulCCfsft3AQeYv23eYUAM9u+2zqytWASbOccQyrTYo+y0
OQc2RLWIANSfLdOvbPDJnig7hHZtER9GwBMlEBnwrsWOjJKZOPLk4g0vY3naCeFB
daEn0LuseLGObfKmUy5JJu6ok7NgKFQWsLazsnMhTwrSSVIHsoedr57V+vUAqlkX
7LVJ066JyER6x0tBBa3jiO99poaFTmLQK35moX7NsKY+74epIj5uQf5uG0btcpA=
=yvvi
-----END PGP SIGNATURE-----

--14QWRO38hCII64m64PCAsdf7M83WdKwCG--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55198400.1040300>