Test case for bug that occurred in 2.27 on mips

coypu@sdf.org coypu@sdf.org
Sat Jan 6 20:47:00 GMT 2018


Hi folks.

I encountered an issue linking the attached file on binutils 2.27 when
targeting mips. I suspect the issue is already fixed, as I see another
resolved bug relating to similar functionality in a newer version.
I don't have the latest binutils to confirm it right now.

I assume there might be some value in it as a test case that has
recently failed, please consider it.

Thanks.
-------------- next part --------------
/*
ld: BFD (NetBSD Binutils nb1) 2.27 assertion fail /usr/src/tools/binutils/../../external/gpl3/binutils/dist/bfd/elfxx-mips.c:10879
collect2: error: ld returned 1 exit status

in function:
_bfd_mips_elf_finish_dynamic_symbol
...

  BFD_ASSERT (h->dynindx != -1
              || h->forced_local);

*/

#define __hidden_ifunc(name, resolver) \
	__asm(".globl	" #name "\n" \
	      ".hidden	" #name "\n" \
	      ".type	" #name ", @gnu_indirect_function\n" \
	      #name " = " #resolver)

static unsigned int
ifunc_helper(void)
{
	return 0xdeadbeef;
}
static __attribute__((used))
unsigned int (*resolve_ifunc(void))(void)
{
	return ifunc_helper;
}
__hidden_ifunc(ifunc, resolve_ifunc);
unsigned int ifunc(void);

int main() { return 0; }


More information about the Binutils mailing list