Skip to content
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

-Alddlflags doesn't work (the way it should) on Linux #13000

Open
p5pRT opened this issue May 27, 2013 · 5 comments
Open

-Alddlflags doesn't work (the way it should) on Linux #13000

p5pRT opened this issue May 27, 2013 · 5 comments
Labels
Closable? We might be able to close this ticket, but we need to check with the reporter distro-Linux

Comments

@p5pRT
Copy link

p5pRT commented May 27, 2013

Migrated from rt.perl.org#118199 (status was 'open')

Searchable as RT118199$

@p5pRT
Copy link
Author

p5pRT commented May 27, 2013

From @nwc10

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

@p5pRT
Copy link
Author

p5pRT commented May 27, 2013

From @Tux

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-archive.perl.org/perl5/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/

@p5pRT
Copy link
Author

p5pRT commented May 27, 2013

The RT System itself - Status changed from 'new' to 'open'

@toddr
Copy link
Member

toddr commented Feb 5, 2020

This ticket sounds like the same issue as #13676. In both cases, I would bet we can just fail if someone tries to compile 32bit perl on a 64 bit system. My suspicion is that nobody would complain.

@toddr toddr added the Closable? We might be able to close this ticket, but we need to check with the reporter label Feb 5, 2020
@khwilliamson
Copy link
Contributor

One of my standard testing configurations includes
-Accflags=-m32 -Aldflags=-m32 -Alddlflags=-m32

@xenu xenu removed the Severity Low label Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closable? We might be able to close this ticket, but we need to check with the reporter distro-Linux
Projects
None yet
Development

No branches or pull requests

4 participants