Skip to content

gcc14.3的zca选项,导致编译ERRATA_THEAD_VECTOR代码报错,有必要修正代码 #279

@GooTal

Description

@GooTal

原pr:9b99c02

用gcc14.3编译时,如果打开CONFIG_ERRATA_THEAD_VECTOR选项,会报错:

make[4]: *** [scripts/Makefile.build:243: arch/riscv/mm/init.o] Error 1
make[4]: *** Waiting for unfinished jobs....
./arch/riscv/include/asm/vector.h: Assembler messages:
./arch/riscv/include/asm/vector.h:251: Error: attempt to move .org backwards
make[4]: *** [scripts/Makefile.build:243: kernel/entry/common.o] Error 1
make[3]: *** [scripts/Makefile.build:480: kernel/entry] Error 2
make[3]: *** Waiting for unfinished jobs....
./arch/riscv/include/asm/vector.h: Assembler messages:
./arch/riscv/include/asm/vector.h:218: Error: attempt to move .org backwards
make[4]: *** [scripts/Makefile.build:243: arch/riscv/kernel/signal.o] Error 1
./arch/riscv/include/asm/vector.h: Assembler messages:
./arch/riscv/include/asm/vector.h:218: Error: attempt to move .org backwards
./arch/riscv/include/asm/vector.h:251: Error: attempt to move .org backwards
make[4]: *** [scripts/Makefile.build:243: arch/riscv/kvm/vcpu_vector.o] Error 1
make[3]: *** [scripts/Makefile.build:480: arch/riscv/kvm] Error 2
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:480: arch/riscv/kernel] Error 2
make[3]: *** [scripts/Makefile.build:480: arch/riscv/mm] Error 2
make[2]: *** [scripts/Makefile.build:480: arch/riscv] Error 2

gcc14.3版本中,以龙蜥开源的gcc为例,
https://gitee.com/src-anolis-os/gcc/blob/rva23-14.3.0/1047-RISC-V-Promote-Zaamo-Zalrsc-to-a-when-using-an-old-b.patch
https://gitee.com/src-anolis-os/gcc/blob/rva23-14.3.0/1055-RISC-V-c-implies-zca-and-conditionally-zcf-zcd.patch
看起来这两个补丁引入的,rv64imac这个里面有a的话,默认添加 zaamo_zalrsc,有c的话,默认添加zca。

zca会导致alternative代码片段长度不一致。

在gcc14.1上,额外增加该字段,也会导致同样的报错:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions