执行共享二进制文件时出现浮点异常,但可以运行静态链接二进制文件

时间:2019-04-23 04:54:25

标签: c backwards-compatibility sigfpe

当运行从(centos 5)生成的共享二进制文件时,我处于浮点异常中(在Linux ubuntu-610 2.6.17-10-generic#2 SMP Tue Dec 5 5 21:16:35 UTC 2006 x86_64 GNU / Linux中) 。2.6.18-398.el5#1 SMP Tue Sep 16 20:50:52 EDT 2014 x86_64 x8n6_64 x86_64 GNU / Linux)
但是静态二进制文件可以运行。

我遇到什么问题? 是否可以解决这种情况?无需在Linux中构建二进制文件ubuntu-610 2.6.17-10-generic#2 SMP Tue Dec 5 21:16:35 UTC 2006 x86_64 GNU / Linux。

  • 目标内核和架构检查

    root @ ubuntu-610:/ tmp / test#uname -a
    Linux ubuntu-610 2.6.17-10-generic#2 SMP Tue Dec 5 5 21:16:35 UTC 2006 x86_64 GNU / Linux
    root @ ubuntu-610:/ tmp / test#getconf -a | grep LONG_BIT
    LONG_BIT 64

  • LDD检查

    root @ ubuntu-610:/ tmp / test#ldd upper_os
            libc.so.6 => /lib/libc.so.6(0x00002b1bf14a5000)
            /lib64/ld-linux-x86-64.so.2(0x00002b1bf1388000)
    root @ ubuntu-610:/ tmp / test#ldd curr_os
            libc.so.6 => /lib/libc.so.6(0x00002b6781649000)
            /lib64/ld-linux-x86-64.so.2(0x00002b678152c000)

  • 文件检查

    ot @ ubuntu-610:/ tmp / test#文件upper_os
    upper_os:ELF 64位LSB可执行文件,AMD x86-64,版本1(SYSV),用于GNU / Linux 2.6.9,动态链接(使用共享库),用于GNU / Linux 2.6.9,未剥离
    root @ ubuntu-610:/ tmp / test#文件curr_os
    curr_os:ELF 64位LSB可执行文件,AMD x86-64,版本1(SYSV),用于GNU / Linux 2.6.0,动态链接(使用共享库),用于GNU / Linux 2.6.0,未剥离

  • 正在运行

    root @ ubuntu-610:/ tmp / test#./upper_os --->内置于上层操作系统
    浮点异常
    root @ ubuntu-610:/ tmp / test#./curr_os --->内置在当前操作系统中
    活着

**静态链接:没问题

** gdb tracking


    root@ubuntu-610:/tmp/test# gdb
    GNU gdb 6.4.90-debian
    Copyright (C) 2006 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".
    (gdb) file upper_os 
    BFD: /tmp/test/upper_os: don't know how to handle OS specific section `.gnu.hash' [0x6ffffff6]
    "/tmp/test/upper_os": not in executable format: File format not recognized
    (gdb) run 
    Starting program:  
    No executable file specified.
    Use the "file" or "exec-file" command.
    (gdb) file curr_os 
    Reading symbols from /tmp/test/curr_os...done.
    Using host libthread_db library "/lib/libthread_db.so.1".
    (gdb) run 
    Starting program: /tmp/test/curr_os 
    alive

    Program exited normally.

#include <stdio.h> 
int main()
{
  printf("alive\n"); 
  return 0; 
}

0 个答案:

没有答案