LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-07-2007, 12:16 AM   #1
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 132

Rep: Reputation: 15
LD warning on AMD64


Hello,

----------------------------------------------------------------------
/usr/bin/ld: warning: i386 architecture of input file
`../bin/linux_gnu/obj1.o' is incompatible with i386:x86-64 output

../bin/linux_gnu/obj1.o(.text+0x35): In function `s_Model':

: undefined reference to `_GLOBAL_OFFSET_TABLE_'

../bin/linux_gnu/obj.o(.text+0x663): In function `ls_getValue':

: undefined reference to `_GLOBAL_OFFSET_TABLE_'

../bin/linux_gnu/obj.o(.text+0x669): In function `ls_getValue':

: undefined reference to `globalObj'
---------------------------------------------------------------------

I tried build obj1.c code on AMD using gcc -m32 obj1.c. I got obj1.o file but when i tried to build shared object from obj1.o using LD, it displays some warning that is "incompatible with i386:x86-65 output".

I knew that i need to use -m elf_i386 LD flags to overcome this warning, but the same steps i followed on sparc64 ( i build obj1.c on sparc64 for 32 bit .o file then i used LD) LD does not display warning. How can i do the same on AMD, I do not understand why LD does not able to find the .o file is 32 bit. Are there any way to not to specifiy -m elf_i386 to generate .o file to shared object?

Please let me know your suggestions.

Thanks,
Dayalan
 
Old 11-08-2007, 11:02 AM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
It all depends on the compiler/linker specifications when they're configured. Are you saying that the sparc64 took -m32 with gcc and didn't require it of ld? When you get down into specific processors you can't expect two procedures to behave the same on two different architectures.

You might be able to link using gcc with the same -m option instead of using ld.
ta0kira
 
Old 11-13-2007, 05:49 AM   #3
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 132

Original Poster
Rep: Reputation: 15
LD: warning on Linux

Quote:
Originally Posted by ta0kira View Post
It all depends on the compiler/linker specifications when they're configured. Are you saying that the sparc64 took -m32 with gcc and didn't require it of ld? When you get down into specific processors you can't expect two procedures to behave the same on two different architectures.

You might be able to link using gcc with the same -m option instead of using ld.
ta0kira
Sparc64 does not need -m32 we need to include -xarch=v9 then compiler will build 64 bit ELF, but ld on Sparc64 is able to understand whether the ELF is 32 bit or 64 bit, but it is not happening in Linux.

Yes you are correct, i will be able to gcc to link object files using -m option.

Thank you for your reply.

Thanks,
Dayalan
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ld: warning drand Linux - Software 2 05-25-2010 04:03 AM
Difference between amd64 generic and amd64 k8? halfpower Linux - General 6 09-07-2006 05:28 PM
GC Warning ashlesha Linux - General 3 07-17-2006 03:58 PM
warning! Volcano Linux - Newbie 4 04-24-2006 07:08 AM
what is this warning in C? h/w Programming 7 10-26-2003 11:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration