Linux C++ ARM-Cross-Compiler floor function bug? -


the following sample application supposed floor integer value:

#include <iostream> #include <math.h>  int round(double val) {     return val + 0.5; }  double round2(double val) {     return floor(val + 0.5); }  int main() {     double val1 = 16.75;     cout << "round 16.75: " << round(val1) << endl;     cout << "round 21.60: " << round2(21.60) << endl;     cout << "round 5.50: " << round(5.50) << endl;     cout << "round 5.40: " << round2(5.40) << endl; } 

on desktop pc both function working correct.

if cross-compile raspberry arm-gnueabi-toolchain (v4.7.2) , copy compiled file on raspberry execute it, function uses floor function returns zero.

if compile application on raspberry works fine.

is bug or doing wrong?

update:

arm-linux-gnueabi-readelf -h -a stamp      elf header:       magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00        class:                             elf32       data:                              2's complement, little endian       version:                           1 (current)       os/abi:                            unix - system v       abi version:                       0       type:                              exec (executable file)       machine:                           arm       version:                           0x1       entry point address:               0x8908       start of program headers:          52 (bytes file)       start of section headers:          4852 (bytes file)       flags:                             0x5000002, has entry point, version5 eabi       size of header:               52 (bytes)       size of program headers:           32 (bytes)       number of program headers:         8       size of section headers:           40 (bytes)       number of section headers:         32       section header string table index: 29     attribute section: aeabi     file attributes       tag_cpu_name: "4t"       tag_cpu_arch: v4t       tag_arm_isa_use: yes       tag_thumb_isa_use: thumb-1       tag_abi_pcs_wchar_t: 4       tag_abi_fp_denormal: needed       tag_abi_fp_exceptions: needed       tag_abi_fp_number_model: ieee 754       tag_abi_align_needed: 8-byte       tag_abi_align_preserved: 8-byte, except leaf sp       tag_abi_enum_size: int       tag_div_use: not allowed 

update2 it's not problem double. when try return float zeros, too.

maby crosscompiler not linking correct float abi try compiling -mfloat-abi=hard . see http://gcc.gnu.org/onlinedocs/gcc/arm-options.html

edit: in thread more specific information building toolset cross compiling raspberrypi: cross-compilation raspberry pi in gcc. start? maby links there can more.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -