Re: Compiling for i586 architecture - illegal instruction on executable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/27/2015 03:36 PM, Renato Mendes wrote:
> I have Ubuntu 12.01 with gcc 4.8.2 as a host and I need to do a cross
> compilation for a Vortex86DX CPU embedded system running an old 2.6.23
> kernel. Although I had succeeded installing a newer 4.7.4 gcc in
> Vortex (from previous post), due to the lack or resources I need to be
> able to cross compile for the Vortex architectue using my Ubuntu host.
> 
> I´m trying the following testing code:
> 
>     #include <iostream>
> 
>     int main()
>     {
>        std::cout << "Hello world" << std::endl;
>     }
> 
> That is compiled using the following command line:
> 
>     g++ -march=i586 test.cpp -o test586.cpp -static -static-libgcc
> -static-libstdc++
> 
> When I run the test586 on the target architecture I´m getting this error:
> 
>     $ ./test586
>     Illegal instruction
> 
> Browsing on the internet it seens that I need to "build the whole
> toolchain for 586" on Ubuntu, but I´m really confused about how to do
> it... Shall I need to install something ?
> 
> Is the -march=i586 parameter the only thing needed ? Isn´t it logical
> to gcc to choose the correct 586 libraries in that case ?
> Does that Illegal instruction problem come from libraries that is
> linked using a 686 architecture ?
> How can I tell the compiler to use the 585 libraries ?
> 
> 
> I´m really very confused on how to solve this issue and help is very
> much appreciated. [here][1]
> 
> 
>   [1]: http://stackoverflow.com/questions/32781281/gcc-cross-compile-to-a-i586-architecture-vortex86dx
> 
Run it in gdb and do a disassemble after you get the fault. 
Post the results here. Esp. the instructions around the instruction pointer(it's marked in the output). 
I do not know if the dmesg log shows the address of the fault, but if it does, 
you might also be able to get at the faulting instruction with nm. 

Background: AFAIK some processors branded as 586 were lacking some 586 instructions. 
You want to know which insn faulted, so you can tell if you have one of those. 




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux