Created attachment 12292 [details] look back for all labels with the same value and compare them with the target .set noat sync 1: lld $5,0($2) bne $5,$0,2f move $1,$3 scd $1,0($2) nop sync 2: .LVL1085 = . .set at lw $2,8($fp) In this example, since `bne` between lld/scd may jump to lw, so if fix-loongson3-llsc option is enabled, a `sync` need to be insert before lw. `bne` can only determine that it will jump to `2:`, but S_GET_NAME( ... lw ...) will give the name of lable `.LVL1085 = .`. It will make no `sync` insert here. In this patch, we can look back for all labels with the same value (S_GET_VALUE), and compare them with the target.
The master branch has been updated by Chenghua Xu <paulhua@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dec7b24be89fe0496f9442232bcbfcb16e030742 commit dec7b24be89fe0496f9442232bcbfcb16e030742 Author: YunQiang Su <syq@debian.org> Date: Fri Feb 28 15:58:13 2020 +0800 MIPS/fix_loongson3_llsc: fix when target has multi labels When there is multi-labels on the same insn, the current code will take care about the last one. it may cause that no sync is added at the target. Here we scan all labels with same value of S_GET_VALUE(label_list->label) by label_list->next. 2020-02-28 YunQiang Su <syq@debian.org> PR gas/25539 * config/tc-mips.c (fix_loongson3_llsc): Compare label value to handle multi-labels. (has_label_name): New.
This problem is fixed by https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dec7b24be89fe0496f9442232bcbfcb16e030742