Re: Size of C/C++ data type from GNU GCC/g++ compiled ELF 64-bit LSB executable, AMD x86-64 vs. ELF 32-bit LSB executable, Intel 80386

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

 



tom peng wrote:
> Hi Andrew,
>
> Thanks for correcting my typo on "signed long int 4 8".
>
> The problem I have here is about simulating a hardware model in C/C++. The
> hardware model development was based on 32-bit CPU originally. We had
> presumed "signed long int" as 32-bit/4 byte length -- as specified in C/C++
> code "typedef signed long int int32".
>
> It is apparent that this "int32" in 64-bit ELF executable is of length 8
> bytes, not what we expect. It "might" cause the hw simulation inconsistency
> when running in 64 vs. 32 ELF format.
>   

If you're on a compatible host, why not just build in 32-bit mode?  If
the app is really not portable and meant to be on 32-bit platforms, then
your options seem obvious.  Either build in 32-bit mode "e.g. -m32", or
fix the application to not depend on the size of given data types (that
is the max size).

In reality, in proper portable code it shouldn't matter.  So long as the
data types are big enough you can always mask off upper bits.

Tom

[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