Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Feb 2018 20:23:09 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 225741] java/openjdk7 java/openjdk8: Fix i386 build when base ld is lld
Message-ID:  <bug-225741-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D225741

            Bug ID: 225741
           Summary: java/openjdk7 java/openjdk8: Fix i386 build when base
                    ld is lld
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: glewis@FreeBSD.org
          Reporter: dim@FreeBSD.org
             Flags: maintainer-feedback?(glewis@FreeBSD.org)
          Assignee: glewis@FreeBSD.org

Created attachment 190400
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D190400&action=
=3Dedit
Add -Wl,-z,notext to openjdk[78] link flags

When building either opendjk7 or openjdk8 on i386, with /usr/bin/ld pointin=
g to
lld (e.g. using the WITH_LLD_IS_LD option), it dies with many errors of the
form:

[...]
Linking vm...
/usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol:
.L.str in readonly segment; recompile object files with -fPIC
>>> defined in adaptiveFreeList.o
>>> referenced by adaptiveFreeList.cpp
>>>               adaptiveFreeList.o:(AdaptiveFreeList<FreeChunk>::print_on=
(outputStream*, char const*) const)

/usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol:
.L.str.1 in readonly segment; recompile object files with -fPIC
>>> defined in adaptiveFreeList.o
>>> referenced by adaptiveFreeList.cpp
>>>               adaptiveFreeList.o:(AdaptiveFreeList<FreeChunk>::print_on=
(outputStream*, char const*) const)

What is happening here is that lld has the "-z text" option on by default
(which produces errors when binaries have dynamic relocations in read-only
sections), as opposed to BFD ld.

For some reason, the openjdk build process does not look at, or care about,=
 the
value of LDFLAGS, but uses its own variable LFLAGS for this purpose.

This patch adds LFLAGS=3D"-Wl,-z,notext" to MAKE_ENV for both openjdk7 and
openjdk8, which turns off the checks for dynamic relocations, and makes the
ports build with lld on i386.

(A future task could attempt to investigate why these text relocations exis=
t at
all, possibly due to some files not being correctly compiled with -fPIC, but
this is much more intrusive.)

--=20
You are receiving this mail because:
You are the assignee for the bug.=



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