Bug 443293 - gnatmake -m32 linking fails
gnatmake -m32 linking fails
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
9
x86_64 Linux
low Severity low
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-20 06:59 EDT by Jan Kratochvil
Modified: 2009-01-26 04:03 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-01-26 04:03:21 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jan Kratochvil 2008-04-20 06:59:35 EDT
Description of problem:
`gnatmake -m32' on x86_64 worked in F-8 but it fails in rawhide.

Version-Release number of selected component (if applicable):
gcc-gnat-4.3.0-7.x86_64
libgnat-4.3.0-7.i386
libgnat-4.3.0-7.x86_64

(but it worked on F-8
gcc-gnat-4.1.2-33.x86_64
libgnat-4.1.2-33.x86_64
libgnat-4.1.2-33.i386
)

How reproducible:
Always.

Steps to Reproduce:
echo -e 'procedure Foo is\nbegin\nnull;\nend Foo;' >foo.adb;rm -f
foo.{,all,o};gnatmake -m32 foo.adb;./foo

Actual results:
gcc -c -m32 foo.adb
gnatbind -x foo.ali
gnatlink foo.ali -m32
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-exctab.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-secsta.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-stalib.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-soflin.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-memory.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(argv.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(exit.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(init.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(initialize.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(final.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(raise-gcc.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(a-except.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-except.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-sopco3.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-stoele.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-strops.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-traceb.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-traent.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-wchcon.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-wchstw.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(cio.o)' is incompatible
with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(tracebak.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(a-elchha.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(s-wchjis.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(raise.o)' is
incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file
`/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a(adaint.o)' is
incompatible with i386 output
collect2: ld returned 1 exit status
gnatlink: error when calling /usr/bin/gcc
gnatmake: *** link failed.
-bash: ./foo: No such file or directory

Expected results:
gcc -c -m32 foo.adb
gnatbind -x foo.ali
gnatlink foo.ali -m32
/usr/bin/ld: skipping incompatible
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/adalib//libgnat-4.1.so when searching for
-lgnat-4.1

Additional info:
The problem is F-8 gnatmake linked libgnat dynamically but F-9 gnatmake links
libgnat statically.
/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a is provided only 64bit

It can be workarounded by appending `-largs -lgnat-4.3':
$ echo -e 'procedure Foo is\nbegin\nnull;\nend Foo;' >foo.adb;rm -f
foo.{,all,o};gnatmake -m32 foo.adb -largs -lgnat-4.3;./foo
gcc -c -m32 foo.adb
gnatbind -x foo.ali
gnatlink foo.ali -m32 -lgnat-4.3
/usr/bin/ld: skipping incompatible
/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib//libgnat-4.3.so when searching for
-lgnat-4.3
(OK)
As it will link with dynamic 32bit /usr/lib/libgnat-4.3.so in this case.

Static building did work neither in F-8 nor in F-9 neither -m64 nor -m32 but in
fact the problem is there always that is missing:
  /usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/libgnat-4.1.a

F-8 gnat was using:
  /usr/bin/gcc b~foo.o ./foo.o -m32 -o foo -L./
-L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/adalib/ -lgnat-4.1
resulting in
open("/usr/lib/gcc/x86_64-redhat-linux/4.1.2/adalib//libgnat-4.1.so", O_RDONLY) = 9
write(2, "/usr/bin/ld: skipping incompatible
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/adalib//libgnat-4.1.so when searching for
-lgnat-4.1\n"
write(2, "/usr/lib/gcc/x86_64-redhat-linux/4.1.2/adalib//libgnat-4.1.so", 61) = 61
open("/usr/lib/gcc/x86_64-redhat-linux/4.1.2/adalib//libgnat-4.1.a", O_RDONLY) =
-1 ENOENT (No such file or directory)
open("/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/libgnat-4.1.so", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/libgnat-4.1.a", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/libgnat-4.1.so", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/libgnat-4.1.a", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib/libgnat-4.1.so",
O_RDONLY) = 9

while F-9 gnat is using:
  /usr/bin/gcc b~foo.o ./foo.o -m32 -o foo -L./
-L/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/
/usr/lib/gcc/x86_64-redhat-linux/4.3.0/adalib/libgnat.a -static-libgcc

Unaware if the F-9 static linking was intentional and 32bit libgnat.a needs to
be provided or whether rather F-9 gnat should start linking dynamically again.
Also I can give up on the GDB gnat -m32 tests or use that workaround above.
Comment 1 Bug Zapper 2008-05-14 05:46:36 EDT
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 2 Jakub Jelinek 2009-01-26 04:03:21 EST
gcc-4.4.0-0.9 in dist-f11-gcc44 has multilib support for Ada, so both gnatmake -m32 and gnatmake -m64 should work on x86_64, ppc, ppc64.

Note You need to log in before you can comment on or make changes to this bug.