linux 命令之 as and ld error

博客讨论了在 Thumb 指令集和 ARM 指令集之间遇到的错误,以及如何通过修改汇编文件从 .archarmv7 更改为 .archarmv7a 来解决该问题。此外,还提到了在创建动态库时遇到的未定义符号问题,解决方案是重新编译源代码时添加 -fPIC 参数。
摘要由CSDN通过智能技术生成

/*
 * Error: attempt to use an ARM instruction on a Thumb-only processor --
 */
    EDIT: apparently, changing in the assembly file from .arch armv7 to .arch armv7a fixes the problem.

    .arch armv7        # Thumb instruction
    .arch armv7a     # Arm instruction

/*
 * dynamic library of create for undefined symbol `g1'
 */
    gcc -c g.c -g -Wall
    gcc -shared g.o -o libg.so

    /usr/bin/ld: g.o: relocation R_X86_64_PC32 against undefined symbol `g1' can not be used when making a shared object; recompile with -fPIC
    /usr/bin/ld: final link failed: bad value
    collect2: error: ld returned 1 exit status

    modified:

    gcc -fPIC -c g.c -g -Wall
    gcc -shared g.o -o libg.so

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值