[Bug 225741] java/openjdk7 java/openjdk8: Fix i386 build when base ld is lld

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Feb 7 20:23:12 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225741

            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 at FreeBSD.org
          Reporter: dim at FreeBSD.org
             Flags: maintainer-feedback?(glewis at FreeBSD.org)
          Assignee: glewis at FreeBSD.org

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

When building either opendjk7 or openjdk8 on i386, with /usr/bin/ld pointing 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="-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 exist at
all, possibly due to some files not being correctly compiled with -fPIC, but
this is much more intrusive.)

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


More information about the freebsd-ports-bugs mailing list