* [opcodes] bfd_flavour
@ 2011-06-06 21:19 Emmanuel Fleury
2011-06-08 14:34 ` Alan Modra
0 siblings, 1 reply; 3+ messages in thread
From: Emmanuel Fleury @ 2011-06-06 21:19 UTC (permalink / raw)
To: binutils
Hi,
I'm trying to use libopcodes for one of my project and I stumbled into
the bfd_flavour parameter.
I tried to code a small disassembler (similar to objdump but way
simpler) with and without setting the bfd_flavour with no significant
difference on my tool.
My question is: What bad can happen if I omit to set the flavour of the
binary that I'm disassembling when using the disassembler_fn of
libopcodes ? (and, subsequently, what is used the bfd_flavour for in
libopcodes ?)
Regards
--
Emmanuel Fleury
And then it happened... a door opened to a world... rushing through the
phone line like heroin through an addict's veins, an electronic pulse is
sent out, a refuge from the day-to-day incompetencies is sought...
a board is found.
This is it... this is where I belong...
-- The Mentor (January 8, 1986, Phrack 7)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [opcodes] bfd_flavour
2011-06-06 21:19 [opcodes] bfd_flavour Emmanuel Fleury
@ 2011-06-08 14:34 ` Alan Modra
2011-06-08 15:55 ` Emmanuel Fleury
0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2011-06-08 14:34 UTC (permalink / raw)
To: Emmanuel Fleury; +Cc: binutils
On Mon, Jun 06, 2011 at 11:23:59PM +0200, Emmanuel Fleury wrote:
> My question is: What bad can happen if I omit to set the flavour of the
> binary that I'm disassembling when using the disassembler_fn of
> libopcodes ?
Is your target one of those that show up below (on the info->flavour
matches, not the bfd_asymbol_flavour matches)? If not, you don't
need to worry.
> (and, subsequently, what is used the bfd_flavour for in
> libopcodes ?)
$ grep flavour *.[ch]
alpha-dis.c: if (info->flavour == bfd_target_evax_flavour)
arm-dis.c: && bfd_asymbol_flavour (*info->symtab) == bfd_target_elf_flavour)
arm-dis.c: if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
arm-dis.c: else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour
arm-dis.c: if (info->flavour == bfd_target_elf_flavour
dis-init.c: info->flavour = bfd_target_unknown_flavour;
mips-dis.c: if (info->flavour == bfd_target_elf_flavour && info->section != NULL)
mips-dis.c: if (info->flavour == bfd_target_unknown_flavour
mips-dis.c: && info->flavour == bfd_target_unknown_flavour)
mips-dis.c: if (!jalx && info->flavour == bfd_target_unknown_flavour)
mips-dis.c: && bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour
sh64-dis.c: && bfd_asymbol_flavour (info->symbols[0]) == bfd_target_elf_flavour
sh64-dis.c: && bfd_get_flavour (info->section->owner) == bfd_target_elf_flavour)
sh64-dis.c: && bfd_asymbol_flavour (info->symbols[0]) == bfd_target_elf_flavour
sh64-dis.c: && bfd_asymbol_flavour (info->symbols[0]) == bfd_target_elf_flavour
sh-dis.c: && bfd_asymbol_flavour(*info->symbols) == bfd_target_coff_flavour)
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [opcodes] bfd_flavour
2011-06-08 14:34 ` Alan Modra
@ 2011-06-08 15:55 ` Emmanuel Fleury
0 siblings, 0 replies; 3+ messages in thread
From: Emmanuel Fleury @ 2011-06-08 15:55 UTC (permalink / raw)
To: binutils
Hi,
On 06/08/2011 04:29 PM, Alan Modra wrote:
> On Mon, Jun 06, 2011 at 11:23:59PM +0200, Emmanuel Fleury wrote:
>> My question is: What bad can happen if I omit to set the flavour of the
>> binary that I'm disassembling when using the disassembler_fn of
>> libopcodes ?
>
> Is your target one of those that show up below (on the info->flavour
> matches, not the bfd_asymbol_flavour matches)?
No, the flavour was more about the CPU sub-architecture and not about
the format of the binary. But, I think I got confused with some other
structure... Sorry for that, I need to take a second look at it.
> If not, you don't need to worry.
Excellent. Thanks a lot.
>> (and, subsequently, what is used the bfd_flavour for in
>> libopcodes ?)
>
> $ grep flavour *.[ch]
> alpha-dis.c: if (info->flavour == bfd_target_evax_flavour)
> arm-dis.c: && bfd_asymbol_flavour (*info->symtab) == bfd_target_elf_flavour)
> arm-dis.c: if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
> arm-dis.c: else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour
> arm-dis.c: if (info->flavour == bfd_target_elf_flavour
> dis-init.c: info->flavour = bfd_target_unknown_flavour;
> mips-dis.c: if (info->flavour == bfd_target_elf_flavour && info->section != NULL)
> mips-dis.c: if (info->flavour == bfd_target_unknown_flavour
> mips-dis.c: && info->flavour == bfd_target_unknown_flavour)
> mips-dis.c: if (!jalx && info->flavour == bfd_target_unknown_flavour)
> mips-dis.c: && bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour
> sh64-dis.c: && bfd_asymbol_flavour (info->symbols[0]) == bfd_target_elf_flavour
> sh64-dis.c: && bfd_get_flavour (info->section->owner) == bfd_target_elf_flavour)
> sh64-dis.c: && bfd_asymbol_flavour (info->symbols[0]) == bfd_target_elf_flavour
> sh64-dis.c: && bfd_asymbol_flavour (info->symbols[0]) == bfd_target_elf_flavour
> sh-dis.c: && bfd_asymbol_flavour(*info->symbols) == bfd_target_coff_flavour)
Ok.
Regards
--
Emmanuel Fleury
Before software should be reusable, it should be usable.
-- Ralph Johnson
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-08 15:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-06 21:19 [opcodes] bfd_flavour Emmanuel Fleury
2011-06-08 14:34 ` Alan Modra
2011-06-08 15:55 ` Emmanuel Fleury
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).