This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ld corrupting .cfi_label uses


On Wed, Mar 08, 2017 at 07:33:07AM -0700, Jan Beulich wrote:
> >>> On 08.03.17 at 15:12, <amodra@gmail.com> wrote:
> > On Fri, Mar 03, 2017 at 01:37:17AM -0700, Jan Beulich wrote:
> >> My problem here is that I don't see any way to know whether
> >> there are symbols (including local ones, but excluding the
> >> section one) or relocations referring to a particular section
> >> (other than going through the raw object file of course), for
> >> easy checking in _bfd_elf_write_section_eh_frame(), or
> >> even better already in _bfd_elf_parse_eh_frame_entry().
> > 
> > Here's a prototype patch.  It hasn't had much testing, and needs a few
> > testcases added, particularly for labels in odd parts of a CIE or FDE.
> > If you could run with this, that would be good.
> 
> Thanks for doing this, but going over the patch I can't seem to spot
> where (generally section symbol relative) relocations are being
> taken care of. Am I simply overlooking something? I ask because
> that's the main problem for my use case, whereas symbols don't
> really matter for the moment (I simply didn't have a need to create
> any so far).

The S_FORCE_RELOC change will result in relocations against local
symbols not being converted to relocations against a section symbol,
and it should also result in a reloc beins emitted even for references
within .eh_frame.  (The latter is one of the things I haven't tested.
There will be a reloc if the reference crosses a frag, I'm not so sure
if within the same frag.  Also, the section test may need to be
!strict.)

> And then, for the ld test case source adjustments, how do these do
> anything useful with no test case output adjustments being needed?

That's another of the unfinished details.  I was using that testcase
and inspecting the result by running readelf and objdump by hand.

Incidentally, trying to use .cfi_label outside of .cfi_startproc
.cfi_endproc results in a gas segfault, and there's no documentation
saying that .cfi_label is only meant to be used in the insn part of a
CIE or FDE.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]