This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] [RISCV] Support subtraction of .uleb128.
There is one minor thing. Maciej has pointed out before that it's
better done with one the percent-codes to `_bfd_error_handler' rather
than aborting the link right away, so that any further link errors are
also reported and you don't have to shake them out one by one. So
report the relocation error via linker's callback function seems to be
better. I think maybe we can report a dangerous relocation for the
mismatched R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128. What I meant
is that,
+ case R_RISCV_SET_ULEB128:
...
+ else
+ {
+ if (uleb128_rel->r_offset != rel->r_offset)
+ {
- (*_bfd_error_handler) (_("%pB: relocation %s mismatched. "),
- input_bfd, howto->name);
- bfd_set_error (bfd_error_bad_value);
+ msg = ("R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128 are mismatched. ");
+ r = bfd_reloc_dangerous;
+ break;
+ }
+ relocation = relocation - uleb128_vma;
+ uleb128_rel = NULL;
+ break;
+ }
+
+ case R_RISCV_SUB_ULEB128:
+ if (uleb128_rel)
+ {
+ if (uleb128_rel->r_offset != rel->r_offset)
+ {
- (*_bfd_error_handler) (_("%pB: relocation %s mismatched. "),
- input_bfd, howto->name);
- bfd_set_error (bfd_error_bad_value);
+ msg = ("R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128 are mismatched. ");
+ r = bfd_reloc_dangerous;
+ break;
+ }
+ relocation = uleb128_vma - relocation;
+ uleb128_rel = NULL;
+ break;
+ }
Thanks and regards
Nelson