[PATCH 0/3] MIPS: Correctly report unsupported `.reginfo' section size in GAS/objcopy

Maciej W. Rozycki macro@mips.com
Fri Feb 2 17:20:00 GMT 2018


Hi,

 We have another problem with `.reginfo' causing an assertion failure, as 
observed in the context of commit 58807c48a5a3 ("_bfd_mips_elf_final_link: 
Notify user about wrong .reginfo size"), specifically here: 
<https://sourceware.org/ml/binutils/2018-01/msg00124.html>.

 It triggers in `_bfd_mips_elf_section_processing' at elfxx-mips.c:7105, 
either by assembling input as simple as:

	.section	.reginfo
	.word		0xdeadbeef

or by renaming a section to `.reginfo' with `objcopy'.  Contrary to what I 
thought and wrote before it is also where output sections are processed, 
but in LD it is called later than `_bfd_mips_elf_always_size_sections', 
making the assertion not reached if one in the latter function has already 
triggered.  In GAS and `objcopy' it does get reached however.

 In the section rename case we are not supposed to otherwise modify the 
section concerned anyhow, so I think there is no other option but to make 
`objcopy' fail gracefully.  GAS might be able to do differently (better?), 
such as with the SEC_FIXED_SIZE section flag I recently proposed for LD, 
however my initial attempt showed that a solution required will be more 
complex than I thought it might be.  Given that the same change that makes 
`objcopy' fail gracefully also works for GAS, I am going to leave it as it 
is for the time being.

 A fix to generic BFD ELF code is required as well a test framework update 
for the change I propose to correct this problem, so I have made it a 
small patch series, updating non-MIPS-specific parts first.  See the
individual change descriptions for details.

  Maciej



More information about the Binutils mailing list