Jump to content

Linking problem

- - - - -

  • Please log in to reply
No replies to this topic

#1
MDM

MDM

    Newbie

  • Members
  • Pip
  • 5 posts
Hey, so I'm trying to use ld to link a gcc c generated file to a nasm elf generated file using the linker script:

OUTPUT_ARCH(x86_64)

OUTPUT_FORMAT("binary")

ENTRY(start)

SECTIONS

{

  .text 0x500 :

  {

    code = .; _code = .; __code = .;

    *(.text)

  }


  .data :

  {

     data = .; _data = .; __data = .;

     *(.data)

     *(.rodata)

  }


  .bss :

  {

    bss = .; _bss = .; __bss = .;

    *(.bss)

  }


  end = .; _end = .; __end = .;

}

The problem is, it returns the error: /usr/local/cross/bin/x86_64-elf-ld: cannot represent machine `x86_64'. I get /usr/local/cross/bin/x86_64-elf-ld: i386:x86-64 architecture of input file `objects/bootloader/loader.o' is incompatible with i386 output
if I change x86_64 to i386, but I would really rather prefer it linking to x86_64. Any help?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users