Bug 746760

Summary: gnatmake -m32 linking fails
Product: Red Hat Enterprise Linux 6 Reporter: Ron Pucul <repucul>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: qe-baseos-tools-bugs
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2CC: law, mpolacek, pzhukov
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gcc-4.4.7-3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-12 22:28:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ron Pucul 2011-10-17 17:40:29 UTC
gnatmake -m32 on x86_64 worked in F-8 and was fixed in early gcc-4.4.x but fails in RHEL-6.1 gcc-4.4.5.x


Version-Release number of selected component (if applicable):
gcc-gnat-4.4.5-6.el6.x86_64

How reproducible:
Always

Steps to Reproduce:  (From bug 443293)
/bin/echo -e ' procedure Foo is\n begin\n   null;\n end 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.4.5/adalib/libgnat.a(s-exctab.o)' is
incompatible with i386 output
.....many more similar to above line....
collect2: ld returned 1 exit status
gnatlink: error when calling /usr/bin/gcc
gnatmake: *** link failed.




Expected results:
Expected an executable to be created using i686(or 386) lib's.


Additional info:
Ref. bug # 443293 -- This seems to have been fixed @ one point then un-fixed.
As in ref'd bug, it can be worked around by adding `-largs -lgnat-4.4` to the gnatmake command (gnatmake -m32 foo.adb -largs -lgnat-4.4).
Looked briefly @ the src rpm and it appears it was setup to be building the 32 bit "multilib" lib's but none are included in the rpms produced when rpmbuild -ba SPEC_FILE is run.

Comment 2 Jakub Jelinek 2011-10-20 09:27:05 UTC
Do you have all of libgnat{,-devel}-4.4*.{i686,x86_64}.rpm installed?

Comment 3 RHEL Program Management 2011-10-25 05:49:44 UTC
Since RHEL 6.2 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 4 Ron Pucul 2011-10-26 15:00:17 UTC
The Gnat packages that are currently installed:(rpm -qa |grep -i gnat)
  gcc-gnat-4.4.5-6.el6.x86_64
  libgnat-devel-4.4.5-6.el6.i686
  libgnat-4.4.5-6.el6.i686
  libgnat-devel-4.4.5-6.el6.x86_64
  libgnat-4.4.5-6.el6.x86_64

Comment 5 Ron Pucul 2012-02-09 18:56:20 UTC
If we use the  "-m32 --RTS=32" flags (added --RT=32 flag) it works.
Suggest the use of this option be mentioned where the -m32 option is in the gcc & gnat pages (http://gcc.gnu.org/onlinedocs/gcc-4.4.4/gnat_ugn_unw/Switches-for-gnatmake.html#S) or equiv.   OR earlier.

Comment 6 Pavel Zhukov 2013-10-10 10:04:12 UTC
works for me:

$ /bin/echo -e ' procedure Foo is\n begin\n   null;\n end Foo;' >foo.adb;rm -f foo.{,all,o};gnatmake -m32 foo.adb;
gcc -c -m32 --RTS=32 foo.adb
gnatbind --RTS=32 -x foo.ali
gnatlink foo.ali -m32


$ rpm -qa | grep -e "gcc\|gnat"
libgnat-4.4.7-3.el6.i686
libgnat-4.4.7-3.el6.x86_64
libgnat-devel-4.4.7-3.el6.i686
libgcc-4.4.7-3.el6.x86_64
libgnat-devel-4.4.7-3.el6.x86_64
gcc-gnat-4.4.7-3.el6.x86_64
libgcc-4.4.7-3.el6.i686
gcc-4.4.7-3.el6.x86_64
gcc-c++-4.4.7-3.el6.x86_64

Comment 7 Ron Pucul 2013-10-10 15:57:56 UTC
Yes -- Appears gnatmake has been fixed in gcc-4.4.7-3 to add the --RTS=32 flag to the compilation/bind.

Comment 8 Marek Polacek 2014-02-11 16:17:46 UTC
Should be fixed then.

Comment 9 Jeff Law 2014-02-12 22:28:30 UTC
This was fixed in RHEL 6.4