Compilando 32 bit em linux 64 bits (linker, ld)

Se você usa scripts para link edição e simplesmente não fez quaisquer alteração nele provavelmente obteve um erro analago:

ld: i386 architecture of input file `loader.o' is incompatible with i386:x86-64 output

Isso é por que o ld está tentando linkar em modo 64 bits objectos 32 bits. Não tem milagre que de jeito. O caminho é reconfigurar o script.
Em geral basta acrescentar as linhas no inicio do arquivo:

  • OUTPUT_FORMAT(“elf32-i386″);
  • OUTPUT_ARCH(i386);

Se vc não usa um script para fazer as ligações  pode obter o mesmo efeito usando o comando:

ld --oformat=elf32-i386 RESTANTE_DAS_FLAGS
This entry was posted in Fedora, Ubuntu, linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>