LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 08-12-2012, 04:41 AM   #1
amboxer21
Member
 
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 285

Rep: Reputation: Disabled
built nasm from source on android but issue with ld linking


Not sure where to put this due to the nature of the content. It is relative to programming, android, and Linux. Anywho, I also posted on xda-developers as well.

I recently installed botbrew on my rooted android device. I built nasm from source and I configured with --host=arm and it built. Then manually installed it in /system/xbin.

I compiled with nasm -felf progname.asm then try and link with ld hello.o -o hello but receive an error.

Code:
 # ld hello.o -o hello
ld: /mnt/sdcard/hello.o: Relocations in generic ELF (EM: 3)
/mnt/sdcard/hello.o: could not read symbols: File in wrong format
What gives? Did I configure nasm wrong?

Last edited by amboxer21; 08-12-2012 at 05:01 AM.
 
Old 08-14-2012, 01:40 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644
What's the output of:
Code:
file hello.o
 
Old 08-14-2012, 01:45 AM   #3
amboxer21
Member
 
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 285

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kbp View Post
What's the output of:
Code:
file hello.o
# file hello.o
hello.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped

SIDE NOTE:
I'm running a live Ubuntu session ATM. The reason for the sysv.

Last edited by amboxer21; 08-14-2012 at 01:48 AM.
 
Old 08-14-2012, 01:47 AM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644
Yep .. it's not arm, I did a bit of searching - I don't think arm is supported at all by nasm.
 
Old 08-14-2012, 02:00 AM   #5
amboxer21
Member
 
Registered: Mar 2012
Location: New Jersey
Distribution: Gentoo
Posts: 285

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kbp View Post
Yep .. it's not arm, I did a bit of searching - I don't think arm is supported at all by nasm.
I have just found that out right now. I did a Google search on nasm on arm and the first link I clicked said exactly that. That arm is not supported by nasm.

You can see that by running

nasm -hf

It will show only that x86 is supported. 32 and 64 bit. Windows and Linux.

Its ashame because I love nasms syntax! Arm has their own assembly language.

EDIT:
Output for nasm -HF
Code:
 valid output formats for -f are (`*' denotes default):
  * bin       flat-form binary files (e.g. DOS .COM, .SYS)
    ith       Intel hex
    srec      Motorola S-records
    aout      Linux a.out object files
    aoutb     NetBSD/FreeBSD a.out object files
    coff      COFF (i386) object files (e.g. DJGPP for DOS)
    elf32     ELF32 (i386) object files (e.g. Linux)
    elf64     ELF64 (x86_64) object files (e.g. Linux)
    elfx32    ELFX32 (x86_64) object files (e.g. Linux)
    as86      Linux as86 (bin86 version 0.3) object files
    obj       MS-DOS 16-bit/32-bit OMF object files
    win32     Microsoft Win32 (i386) object files
    win64     Microsoft Win64 (x86-64) object files
    rdf       Relocatable Dynamic Object File Format v2.0
    ieee      IEEE-695 (LADsoft variant) object file format
    macho32   NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (i386) object files
    macho64   NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (x86_64) object files
    dbg       Trace of all info passed to output stage
    elf       ELF (short name for ELF32)
    macho     MACHO (short name for MACHO32)
    win       WIN (short name for WIN32)
#

Last edited by amboxer21; 08-14-2012 at 02:05 AM.
 
  


Reply

Tags
android, botbrew, ld, nasm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to show kernel version in android pre-built image via shell? oopsmonk Linux - Newbie 3 06-11-2012 03:28 AM
debugging nasm source code rblampain Programming 2 12-05-2010 09:17 AM
linking .o files built in user space against kernel module using kbuild santigopal_mondal Linux - Newbie 1 01-03-2009 03:42 PM
Strange C++ linking issue >.> EnigmaX Programming 7 09-28-2005 07:11 AM
problems with linking objects -- must know some nasm\ASM\linker Paul6253 Programming 1 10-26-2004 09:33 PM


All times are GMT -5. The time now is 01:11 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration