develooper Front page | perl.perl5.porters | Postings from May 2013

[perl #118199] -Alddlflags doesn't work (the way it should) on Linux

Thread Next
From:
Nicholas Clark
Date:
May 27, 2013 14:01
Subject:
[perl #118199] -Alddlflags doesn't work (the way it should) on Linux
Message ID:
rt-3.6.HEAD-2650-1369663233-966.118199-75-0@perl.org
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #118199]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118199 >


If I configure perl to build as 32 bit on a 32/64 bit system:

./Configure -des -Dusedevel -Accflags=-m32 -Aldflags=-m32 -Alddlflags=-m32

the build fails. This is a re-run of make:

./miniperl -Ilib make_ext.pl lib/auto/B/B.so MAKE=make LIBPERL_A=libperl.a LINKTYPE=dynamic
        Making B (all)
make[1]: Entering directory `/home/nick/Perl/perl/ext/B'
make[1]: Leaving directory `/home/nick/Perl/perl/ext/B'
Making all in ext/B
 make all PERL_CORE=1 LIBPERL_A=libperl.a LINKTYPE=dynamic
make[1]: Entering directory `/home/nick/Perl/perl/ext/B'
rm -f ../../lib/auto/B/B.so
cc  -m32 -L/usr/local/lib -fstack-protector B.o  -o ../../lib/auto/B/B.so      \
                \
          
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 0 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 1 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 4 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 5 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 6 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 7 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 8 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 9 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 10 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 11 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 12 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 13 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 14 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 15 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 16 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 17 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 18 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 19 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 20 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 21 has invalid symbol index 14
/usr/bin/ld: /usr/lib/debug/usr/lib32/crt1.o(.debug_info): relocation 22 has invalid symbol index 22
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib32/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
B.o: In function `boot_B':
B.c:(.text+0x16): undefined reference to `PL_stack_sp'


The problem is that the -Alddlflags happens at the wrong time relative to
everything else. Configure sets a default if none is set yet:

    case "$lddlflags" in
    '') case "$osname" in
  			beos) dflt='-nostart' ;;
  			haiku) dflt='-shared' ;;
			hpux) dflt='-b';
			      case "$gccversion" in
			      '') dflt="$dflt +vnocompatwarnings" ;;
			      esac
			      ;;
			linux|irix*|gnu*)  dflt="-shared $optimize" ;;
			next)  dflt='none' ;;
			solaris) dflt='-G' ;;
			sunos) dflt='-assert nodefinitions' ;;
			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
	        *)     dflt='none' ;;
			esac
			;;
    *) dflt="$lddlflags" ;;
    esac


but because -A processing has already happened, lddlflags is already set to
something. This certainly isn't the intent of -A

./myconfig for the bust configuration:

Summary of my perl5 (revision 5 version 19 subversion 1) configuration:
   
  Platform:
    osname=linux, osvers=2.6.32-5-amd64, archname=x86_64-linux
    uname='linux gcc20 2.6.32-5-amd64 #1 smp mon jan 16 16:22:28 utc 2012 x86_64 gnulinux '
    config_args='-des -Dusedevel -Accflags=-m32 -Aldflags=-m32 -Alddlflags=-m32'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-m32 -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-m32 -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.4.5', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -m32 -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.11.3.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.11.3'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags=' -m32 -L/usr/local/lib -fstack-protector'


If I run Configure like this, adding -shared:

./Configure -des -Dusedevel -Accflags=-m32 -Aldflags=-m32 -Alddlflags=-m32\ -shared

the build is fine (and all tests pass)

Nicholas Clark


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About