mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-19 14:34:07 +08:00
2013-01-31 Tristan Gingold <gingold@adacore.com>
* mach-o.c (bfd_mach_o_scan): Call bfd_mach_o_flatten_sections earlier. Fix status checking of bfd_mach_o_scan_start_address. (bfd_mach_o_scan_start_address): Handle LC_MAIN.
This commit is contained in:
parent
393dab1504
commit
c0fd7846dc
@ -1,3 +1,9 @@
|
||||
2013-01-31 Tristan Gingold <gingold@adacore.com>
|
||||
|
||||
* mach-o.c (bfd_mach_o_scan): Call bfd_mach_o_flatten_sections
|
||||
earlier. Fix status checking of bfd_mach_o_scan_start_address.
|
||||
(bfd_mach_o_scan_start_address): Handle LC_MAIN.
|
||||
|
||||
2013-01-31 Alan Modra <amodra@gmail.com>
|
||||
David S. Miller <davem@davemloft.net>
|
||||
|
||||
|
17
bfd/mach-o.c
17
bfd/mach-o.c
@ -3979,6 +3979,18 @@ bfd_mach_o_scan_start_address (bfd *abfd)
|
||||
cmd = &mdata->commands[i].command.thread;
|
||||
break;
|
||||
}
|
||||
else if (mdata->commands[i].type == BFD_MACH_O_LC_MAIN
|
||||
&& mdata->nsects > 1)
|
||||
{
|
||||
bfd_mach_o_main_command *main_cmd = &mdata->commands[i].command.main;
|
||||
bfd_mach_o_section *text_sect = mdata->sections[0];
|
||||
if (text_sect)
|
||||
{
|
||||
abfd->start_address = main_cmd->entryoff
|
||||
+ (text_sect->addr - text_sect->offset);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd == NULL)
|
||||
return FALSE;
|
||||
@ -4121,10 +4133,11 @@ bfd_mach_o_scan (bfd *abfd,
|
||||
}
|
||||
}
|
||||
|
||||
if (bfd_mach_o_scan_start_address (abfd) < 0)
|
||||
/* Sections should be flatten before scanning start address. */
|
||||
bfd_mach_o_flatten_sections (abfd);
|
||||
if (!bfd_mach_o_scan_start_address (abfd))
|
||||
return FALSE;
|
||||
|
||||
bfd_mach_o_flatten_sections (abfd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user