Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Binary File Descriptor library
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|GNU support for multiple executable file formats}} {{notability|Products|date=July 2011}} {{Infobox software | name = Binary File Descriptor library | logo = <!-- [[File: ]] --> | screenshot = <!-- [[File: ]] --> | caption = | collapsible = | author = [[Cygnus Solutions]] | developer = | released = <!-- {{start date|YYYY|MM|DD}} --> | discontinued = | latest release version = | latest release date = <!-- {{start date and age|YYYY|MM|DD}} --> | latest preview version = | latest preview date = <!-- {{start date and age|YYYY|MM|DD}} --> | programming language = [[C (programming language)|C]] | operating system = | platform = | size = | language = | status = | genre = [[Library (computing)|Library]] | license = [[GNU General Public License]] | website = }} The '''Binary File Descriptor library''' ('''BFD''') is the [[GNU Project]]'s main mechanism for the [[software portability|portable]] manipulation of [[object file]]s in a variety of formats. {{As of|2003}}, it supports approximately 50 file formats and 25 [[instruction set architecture]]s. ==History== When [[David Henkel-Wallace]] of [[Cygnus Solutions|Cygnus Support]] proposed developing the library as a way to open up new business opportunities for the company, [[Richard Stallman]] said that it would be difficult; David's response was that it wasn't such a "Big Fucking Deal". Abbreviated to "BFD", this became the library name.<ref> {{Cite web | title = Open Sources: Voices from the Open Source Revolution |date=January 1999 | publisher = O'Reilly | url = http://oreilly.com/catalog/opensources/book/tiemans.html | access-date = 2011-11-11 | quote = Gumby began designing the library and discussing the design with Stallman. Stallman said that the job was too difficult—it would require a complete rewrite of all the tools, and it would be too difficult to maintain. Gumby told him it wasn't such a "Big F*cking Deal" and hence named this new creation the BFD library. (We explained to our customers that BFD stood for the binary file descriptor library.) }}</ref> "Binary File Descriptor" was invented later as a [[backronym]] for "BFD". == Design == BFD works by presenting a common abstract view of object files. An object file has a "header" with descriptive info; a variable number of "sections" that each has a name, some attributes, and a block of data; a [[symbol table]]; [[Relocation (computer science)|relocation]] entries; and so forth. Internally, BFD translates the data from the abstract view into the details of the bit/byte layout required by the target [[Central processing unit|processor]] and file format. Its key services include handling [[byte order]] differences, such as between a [[little-endian]] host and [[big-endian]] target, correct conversion between [[32-bit]] and [[64-bit]] data, and details of [[Memory address|address]] arithmetic specified by relocation entries. BFD<ref>[https://ftp.gnu.org/old-gnu/Manuals/bfd-2.9.1/html_chapter/bfd_1.html BFD specification]</ref> library can be logically divided into two parts. The front-end and the back-end. The front-end gives a common interface independent of underlying object file view. Users will be interacting with the object files with this interface. Even if the layout of the object files are not known to the user, the user would still be able to use the interface. This hiding of the detail is done with the help of the back-end. The back-end implements how the front-end interface interacts with the object files layout. Whenever a new object files type is introduced the back-end needs to register the type and implement it if it needs to be supported by the BFD application. Although BFD was originally designed to be a generic library usable by a wide variety of tools, the frequent need to tinker with the API to accommodate new systems' capabilities has tended to limit its use;<ref>{{cite mailing list |url= http://lists.debian.org/debian-devel/2005/05/msg01086.html |title= Re: depending on shared libbfd from binutils-dev |date= 2005-05-22 |access-date=2011-04-03 |mailing-list= debian-devel |last= Langasek|first= Steve |language= en }}</ref><ref>{{cite mailing list |url= http://lists.fedoraproject.org/pipermail/packaging/2010-June/007154.html |title= binutils once more|date= 2010-06-04 |access-date=2011-04-03 |mailing-list= Fedora-packaging |last= Kuratomi |first= Toshio |language= en }}</ref><ref>{{cite mailing list |url= http://www.sourceware.org/ml/binutils/2003-09/msg00216.html|title= Re: FreeBSD 4.6 - binutils 2.14 installs useless libbfd|date= 2003-09-12|access-date=2011-04-03 |mailing-list= binutils|last= Taylor|first= Ian |language= en }}</ref> BFD's main clients are the [[GNU Assembler]] (GAS), [[GNU Linker]] (GLD),<ref>{{cite web |url=https://sourceware.org/binutils/docs/ld/Overview.html |title=GNU ld manual - 1. Overview |publisher=[[GNU Project]]}} See also: {{cite web |url=https://sourceware.org/binutils/docs/ld/BFD.html |title=GNU ld manual - 7. BFD}}</ref> and other [[GNU Binary Utilities]] ("binutils") tools, and the [[GNU Debugger]] (GDB). As a result, BFD is not distributed separately, but is always included with releases of binutils and GDB. Nevertheless, BFD is a critical component in the use of GNU tools for [[embedded system]]s development. The BFD library can be used to read the structured data out of a [[core dump]]. ==BFD library usage== Eg: Print object file size using bfd library APIs. <syntaxhighlight lang="c"> #include "bfd.h" #include <stdio.h> int main() { bfd* abfd = bfd_openr("a.o",NULL); printf("%llu\n", bfd_get_size(abfd)); return 0; } </syntaxhighlight> Build command: <pre> gcc main.c -lbfd -o output ./output # prints the size </pre> ==References== {{Portal|Free and open-source software}} {{Reflist}} ==External links== * [http://sourceware.org/binutils/ Binutils page, with access to current BFD sources] * [https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=binutils/objdump.c;hb=HEAD objdump implementation, uses many BFD apis] {{GNU}} {{DEFAULTSORT:Binary File Descriptor Library}} [[Category:C (programming language) libraries]] [[Category:Executable file formats]] [[Category:Free computer libraries]] [[Category:GNU Project software]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:As of
(
edit
)
Template:Cite mailing list
(
edit
)
Template:Cite web
(
edit
)
Template:GNU
(
edit
)
Template:Infobox software
(
edit
)
Template:Notability
(
edit
)
Template:Portal
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)