Skip to content

Commit

Permalink
Fix -Wunused-variable
Browse files Browse the repository at this point in the history
Fixes #1063
  • Loading branch information
rui314 committed Jul 28, 2023
1 parent 1582b72 commit b78f237
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions elf/arch-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ template <typename E>
void InputSection<E>::apply_reloc_alloc(Context<E> &ctx, u8 *base) {
std::span<const ElfRel<E>> rels = get_rels(ctx);

ElfRel<E> *dynrel = nullptr;
[[maybe_unused]] ElfRel<E> *dynrel = nullptr;
if (ctx.reldyn)
dynrel = (ElfRel<E> *)(ctx.buf + ctx.reldyn->shdr.sh_offset +
file.reldyn_offset + this->reldyn_offset);
Expand All @@ -60,7 +60,7 @@ void InputSection<E>::apply_reloc_alloc(Context<E> &ctx, u8 *base) {
Symbol<E> &sym = *file.symbols[rel.r_sym];
u8 *loc = base + rel.r_offset;

auto check = [&](i64 val, i64 lo, i64 hi) {
[[maybe_unused]] auto check = [&](i64 val, i64 lo, i64 hi) {
if (val < lo || hi <= val)
Error(ctx) << *this << ": relocation " << rel << " against "
<< sym << " out of range: " << val << " is not in ["
Expand Down Expand Up @@ -105,7 +105,6 @@ void InputSection<E>::apply_reloc_alloc(Context<E> &ctx, u8 *base) {

u64 S = sym.get_addr(ctx);
u64 A = rel.r_addend;
u64 P = get_addr() + rel.r_offset;

switch (rel.r_type) {
case R_MIPS_64:
Expand Down

0 comments on commit b78f237

Please sign in to comment.