New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make error with gcc under SunOS #778

Open
michaelortmann opened this Issue Nov 23, 2018 · 0 comments

Comments

Projects
None yet
3 participants
@michaelortmann
Member

michaelortmann commented Nov 23, 2018

$ uname -a
SunOS zen 5.11 11.3 sun4v sparc sun4v

gcc 7.3.0

$ gmake
[...]
Successful compile: eggdrop

gmake[2]: Leaving directory `/export/home/michael/usr/src/eggdrop/src'
gmake[1]: Leaving directory `/export/home/michael/usr/src/eggdrop/src'

Making modules...

gmake[1]: Entering directory `/export/home/michael/usr/src/eggdrop/src/mod'
gmake[2]: Entering directory `/export/home/michael/usr/src/eggdrop/src/mod/assoc.mod'
gcc -fPIC -g -O2 -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod  -DHAVE_CONFIG_H -I/usr/include -g3 -DDEBUG -DDEBUG_ASSERT -DDEBUG_MEM -DDEBUG_DNS  -DMAKING_MODS -c .././assoc.mod/assoc.c && mv -f assoc.o ../
gcc -G -z text  -g -O2 -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod  -DHAVE_CONFIG_H -I/usr/include -g3 -DDEBUG -DDEBUG_ASSERT -DDEBUG_MEM -DDEBUG_DNS -o ../../../assoc.so ../assoc.o -L/usr/lib -ltcl8.5  -lsocket -lnsl -lpthread -lm -lssl -lcrypto -lsocket -lnsl   && touch ../../../assoc.so
Text relocation remains                         referenced
    against symbol                  offset      in file
_init                               0x44        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
main                                0x7c        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
_fini                               0x24        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
_fini                               0x28        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
_fini                               0x2c        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
_fini                               0x30        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
_environ                            0x60        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
_environ                            0x64        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
_environ                            0x68        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
_environ                            0x6c        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
_exit                               0x8c        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
atexit                              0x1c        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
atexit                              0x3c        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
exit                                0x84        /usr/gcc/7/lib/gcc/sparcv9-solaris2.11/7.3.0/crt1.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: error: ld returned 1 exit status
gmake[2]: *** [../../../assoc.so] Error 1
gmake[2]: Leaving directory `/export/home/michael/usr/src/eggdrop/src/mod/assoc.mod'
gmake[1]: *** [assoc.mod_so] Error 2
gmake[1]: Leaving directory `/export/home/michael/usr/src/eggdrop/src/mod'
gmake: *** [debug] Error 2
[...]

The Problem is caused by -z text.

-z text doesn't come from the following block in aclocal.m4, which instead tries to fix the problem with line SHLIB_LD="$CC -shared".

aclocal.m4:
[...]
    SunOS)
      if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 5; then
        # Solaris
        if test -n "$GCC"; then
          SHLIB_CC="$CC -fPIC"
          SHLIB_LD="$CC -shared"
        else
          SHLIB_CC="$CC -KPIC"
          SHLIB_LD="$CC -G -z text"
        fi
      else
        # SunOS 4
        SUNOS="yes"
        SHLIB_LD="ld"
        SHLIB_CC="$CC -PIC"
      fi
    ;;
[...]

-z text comes from aclocal.m4 line AC_SUBST(SHLIB_LD, $TCL_SHLIB_LD), which is executed long after the block above and rendering it ineffective, see alsothe following output of configure:

checking for Tcl linker... ${CC} -G -z text ${LDFLAGS}

@michaelortmann michaelortmann referenced a pull request that will close this issue Nov 23, 2018

Open

Fix SunOS 5 gcc and remove SunOS 4 workarounds #779

@Cizzle Cizzle added this to the v1.8.4 milestone Dec 10, 2018

@vanosg vanosg modified the milestones: v1.8.4, v1.9.0 Dec 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment