This is the mail archive of the 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: Patch: minor som.c fix for --enable-targets=all

On Thu, Jan 24, 2013 at 10:40:11AM -0700, Tom Tromey wrote:
> Alan> Yes please.  I can't see how sections created in setup_sections would
> Alan> be missing their som_section_data, so suspect your patch is covering
> Alan> up some other bug.
> Here it is.
> This is just a random executable from the gdb test suite.

On entry to som_object_p, I see

Breakpoint 1, som_object_p (abfd=0x15fc1c0) at /src/binutils-current/bfd/som.c:2395
(gdb) p abfd->sections
$1 = (struct bfd_section *) 0x15fdae0
(gdb) p *abfd->sections
$2 = {name = 0x1079742 ".text", id = 16, index = 0, next = 0x15fdc10,
(gdb) up
#1  0x000000000050b8ea in bfd_check_format_matches (abfd=0x15fc1c0, format=<optimised out>, matching=0x7fffffffde58) at /src/binutils-current/bfd/format.c:215
(gdb) p matching_vector
$3 = (const bfd_target **) 0x15fe510
(gdb) p matching_vector[0]
$4 = (const bfd_target *) 0x1114940
(gdb) p *matching_vector[0]
$5 = {name = 0x1114930 "a.out-newsos3", flavour = bfd_target_aout_flavour,

So the real problem is left-over crud from a previous target match.
Now in the case of this particular objdump call, assuming som.c is
modified to tolerate this, we'll just exit with

	objdump: Matching formats: a.out-newsos3 som

but it's possible for bfd_check_format_matches to return without an
error when more than one target matches.  If that happens the bfd will
be in a right royal mess.

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]