Compiling 32-bit programs on 64-bit Linux

Source: Internet
Author: User

The LD directive has an option:--oformat output_format, which specifies the format of the output file. The input file./KERNEL/KERNEL.O is the ELF32 format, the current system is 64 bits, and the LD default generated file format is elf64-x86-64; "ld:warning:i386 Architecture of Input file './KERNEL/KERNEL.O ' is incompatible with i386:x86-64 output " . Before transferring the system from three piers to my own Ubuntu computer, I added the--oformat elf32-i386 option to solve this problem.

But today, when compiling the system on the AMD64-bit machine and the CentOS system, the following prompt appears:
ld:warning:i386 Architecture of input file './KERNEL/KERNEL.O ' is incompatible with i386:x86-64 output
.......
all. o files appear similar errors. Therefore, it is inferred that the current system's LD directive does not support the--oformat elf32-i386 option.
The LD directive also has an option-memulation, abbreviated-M. The following documentation is provided: -memulation emulate the emulation linker. You can list the available emulations with the --verbose or-v options.
If the-m option is not used, the emulation was taken from the "Ldemulation" environment variable, if is defined.
Otherwise, the default emulation depends upon how the linker was configured.That is, this option simulates the LD linker on other platforms. Use the-M elf_i386 to simulate LD directives on 32-bit platforms. After rewriting makefile, "make" does not have above warning hint, the system operation also resumed normal. Reference http://blog.csdn.net/galaft/archive/2010/01/13/5184984.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.