Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6577886

Add -z defs to Linux 64bit builds

XMLWordPrintable

    • b18
    • generic
    • linux
    • Not verified

      Contribution from Diego "Flameeyes" Pettenò:
      --------------------------------------------

      The gmk file currnetly allow usage of -z defs as LDFLAGS only for
      arches that are not PPC and are not 64-bit, without any comment on why
      this happens; counting that PPC Linux does not seem to be supported by
      OpenJDK anyway at the moment, -z defs works *mostly* fine on AMD64
      Linux.

      Where mostly is referred to demos that links using gcc even when the
      source code is C++, using the LIBCXX variable to fix the link; this
      works fine, unless you use STATIC_CXX=false at build time to use
      runtime link to libstdc++.

      The attached patch removes the conditionals and fixes the libstdc++
      build, allowing a safer build with -z defs enabled even on amd64.

      -- Diego "Flameeyes" Pettenò http://farragut.flameeyes.is-a-geek.org/



      Index: openjdk/j2se/make/common/Defs-linux.gmk
      ===================================================================
      --- openjdk.orig/j2se/make/common/Defs-linux.gmk
      +++ openjdk/j2se/make/common/Defs-linux.gmk
      @@ -208,12 +208,8 @@ endif
       
       EXTRA_LIBS += -lc
       
      -ifneq ($(ARCH),ppc)
      - ifneq ($(ARCH_DATA_MODEL),64)
      - LDFLAGS_DEFS_OPTION = -z defs
      - LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)
      - endif
      -endif
      +LDFLAGS_DEFS_OPTION = -z defs
      +LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)
       
       #
       # -L paths for finding and -ljava
      @@ -288,7 +284,7 @@ override LEX_LIBRARY = -lfl
       ifeq ($(STATIC_CXX),true)
       override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic
       else
      -override LIBCXX =
      +override LIBCXX = -lstdc++
       endif
       override LIBPOSIX4 =
       override LIBSOCKET =

            ohair Kelly Ohair (Inactive)
            ohair Kelly Ohair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: