LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   built nasm from source on android but issue with ld linking (https://www.linuxquestions.org/questions/programming-9/built-nasm-from-source-on-android-but-issue-with-ld-linking-4175421672/)

amboxer21 08-12-2012 03:41 AM

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?

kbp 08-14-2012 12:40 AM

What's the output of:
Code:

file hello.o

amboxer21 08-14-2012 12:45 AM

Quote:

Originally Posted by kbp (Post 4753623)
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.

kbp 08-14-2012 12:47 AM

Yep .. it's not arm, I did a bit of searching - I don't think arm is supported at all by nasm.

amboxer21 08-14-2012 01:00 AM

Quote:

Originally Posted by kbp (Post 4753629)
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)
#



All times are GMT -5. The time now is 08:40 PM.