查看问题详情

编号项目分类查看权限最后更新
0000077Gcc[所有项目] 所有分类公开2019-06-11 16:49
报告员brep分派给xuchenghua 
优先级严重性很严重出现频率总是
状态 已分配处理状况未处理 
平台loongson操作系统Loongnix操作系统版本3.10.84-16.fc21.
摘要0000077: gas 汇编器的 dla 宏得不到正确的地址
描述        .data
var: .word 3

        .text
        .globl main
        .ent main
main: dla $t0, var
        li $t1, 5
        sw $t1, ($t0)
        jr $ra
        .end main
问题重现步骤$ gcc -mips64r2 -O0 -g -o mem mem.S
$ gdb mem
(gdb) start
Temporary breakpoint 1 at 0x120000a94: file mem.S, line 9.
Starting program: /home/brep/temp/mem
Missing separate debuginfos, use: debuginfo-install glibc-2.20-14.fc21.loongson.9.mips64el

Temporary breakpoint 1, main () at mem.S:9
9 li $t1, 5
(gdb) s
10 sw $t1, ($t0)
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
main () at mem.S:10
10 sw $t1, ($t0)
(gdb)
标签没加标签.

活动

brep

2017-09-20 22:38

报告者   ~0000275

[brep@Loongson temp]$ gcc -v
使用内建 specs。
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/mips64el-redhat-linux/4.9.3/lto-wrapper
目标:mips64el-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-arch=loongson3a --enable-languages=c,c++,objc,obj-c++,fortran,go,lto --enable-plugin --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.3/obj-mips64el-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.3/obj-mips64el-redhat-linux/cloog-install --enable-gnu-indirect-function --with-long-double-128 --build=mips64el-redhat-linux
线程模型:posix
gcc 版本 4.9.3 20150626 (Red Hat 4.9.3-6) (GCC)
[brep@Loongson temp]$ gdb -v
GNU gdb (GDB) Fedora 7.8.1-30.fc21.loongson
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mips64el-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".

brep

2017-09-21 03:24

报告者   ~0000276

自己定义一个可以凑合着用:
.macro dla reg, label
    lui $t0, %highest(\label)
    daddiu $t0, $t0, %higher(\label)
    dsll32 $t0, $t0, 0
    lui $t1, %hi(\label)
    daddiu $t1, %lo(\label)
    daddu $t0, $t0, $t1
    move \reg, $t0
.endm

xuchenghua

2017-10-12 20:49

管理员   ~0000278

请使用-mno-abicalls。否则gcc会默认使用pic代码编译,dla会展开乘gp寻址,由于gp没有初始化,所以段错误了,不是汇编器问题。

问题历史

日期 用户名 字段 更改
2017-09-20 22:36 brep 新建问题
2017-09-20 22:38 brep 注释已添加: 0000275
2017-09-21 03:24 brep 注释已添加: 0000276
2017-10-12 20:49 xuchenghua 注释已添加: 0000278
2019-06-11 16:49 administrator 分派给 => xuchenghua
2019-06-11 16:49 administrator 状态 新建 => 已分配