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

Re: [perl #118199] -Alddlflags doesn't work (the way it should) onLinux

Thread Previous
From:
H.Merijn Brand
Date:
May 27, 2013 15:57
Subject:
Re: [perl #118199] -Alddlflags doesn't work (the way it should) onLinux
Message ID:
20130527175658.1d572374@pc09.procura.nl
On Mon, 27 May 2013 07:00:33 -0700, Nicholas Clark (via RT)
<perlbug-followup@perl.org> wrote:

> # 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)

Is this something common to all builds, or gcc specific?

I mean gcc is obviously used as loader on these systems, whereas on
some the hints automatically switch to ld (see hpux and solaris in the
above example). Sometimes it is a nasty cooperation with the hints.

That also re-raises the question: do we care enough to add
-Duse32bitall support? The default on most 64bit Linux distributions is
to build 64bit

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.17   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Previous


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