1 /* Extracted from GDB sources. */
3 typedef long long bfd_signed_vma
;
4 typedef bfd_signed_vma file_ptr
;
6 typedef enum bfd_boolean
{false, true} boolean
;
8 typedef unsigned long long bfd_size_type
;
10 typedef unsigned int flagword
;
12 typedef unsigned long long CORE_ADDR
;
13 typedef unsigned long long bfd_vma
;
19 struct asection_struct
{
20 unsigned int user_set_vma
: 1;
23 unsigned int alignment_power
;
27 typedef struct bfd_struct bfd
;
28 typedef struct asection_struct asection
;
31 bfd_openw_with_cleanup (char *filename
, const char *target
, char *mode
);
34 bfd_make_section_anyway (bfd
*abfd
, const char *name
);
37 bfd_set_section_size (bfd
*abfd
, asection
*sec
, bfd_size_type val
);
40 bfd_set_section_flags (bfd
*abfd
, asection
*sec
, flagword flags
);
43 bfd_set_section_contents (bfd
*abfd
, asection
*section
, void * data
, file_ptr offset
, bfd_size_type count
);
46 dump_bfd_file (char *filename
, char *mode
,
47 char *target
, CORE_ADDR vaddr
,
53 obfd
= bfd_openw_with_cleanup (filename
, target
, mode
);
54 osection
= bfd_make_section_anyway (obfd
, ".newsec");
55 bfd_set_section_size (obfd
, osection
, len
);
56 (((osection
)->vma
= (osection
)->lma
= (vaddr
)), ((osection
)->user_set_vma
= (boolean
)true), true);
57 (((osection
)->alignment_power
= (0)),true);
58 bfd_set_section_flags (obfd
, osection
, 0x203);
59 osection
->entsize
= 0;
60 bfd_set_section_contents (obfd
, osection
, buf
, 0, len
);
64 bfd_openw_with_cleanup (char *filename
, const char *target
, char *mode
)
66 static bfd foo_bfd
= { 0 };
71 bfd_make_section_anyway (bfd
*abfd
, const char *name
)
73 static asection foo_section
= { false, 0x0, 0x0, 0 };
79 bfd_set_section_size (bfd
*abfd
, asection
*sec
, bfd_size_type val
)
85 bfd_set_section_flags (bfd
*abfd
, asection
*sec
, flagword flags
)
90 bfd_set_section_contents (bfd
*abfd
, asection
*section
, void * data
, file_ptr offset
, bfd_size_type count
)
92 if (count
!= (bfd_size_type
)0x1eadbeef)
96 static char hello
[] = "hello";
100 dump_bfd_file(0, 0, 0, (CORE_ADDR
)0xdeadbeef, hello
, (int)0x1eadbeef);