Re: [PATCH 0/4] OpenRISC binutils updates and new relocs

Nick Clifton
2018-09-28T15:39:09Z

Hi Stafford,

> To produce these errors I need to change the code, Using abort we see:
>
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-elf/9.0.0/../../../../or1k-elf/bin/ld: \
> BFD (GNU Binutils) 2.31.51.20180927 internal error, \
> aborting at ../../binutils-gdb/bfd/elf32-or1k.c:1152 in or1k_final_link_relocate

> There is no segmentation fault.

Sorry, you are right - the abort does not trigger a segmentation fault.

> I agree, it is more nice to create a message
> inform which error triggered the issue.
>
> Is something like this ok?
>
> default:
> _bfd_error_handler
> (_("%pB: Unknown complain on overflow value on howto specified %d"),
> input_bfd, (int) howto->complain_on_overflow);
> abort();
>
> i.e. _bfd_error_handler() followed by abort(). I couldn't really see a way to
> _bfd_error_handler() to actually cause the program to exit.

Depending upon where you are in your code, if you have access to the link_info
structure you can use its einfo() routine instead of bfd_error_handler. This
has the advantage that it allows a %X formatting directive, which causes the
program to terminate with an error exit code.

But otherwise, if there is no reasonable way to return to the caller, then
caryr on using abort. Adding the error messages still helps though.

Cheers
Nick