* gcc.target/i386/mpx/hard-reg-1-nov.c (mpx_test): Use "esp"
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20020404-1.c
blobfe5ea14fad79865b17fd2036ec857b09e7bb913d
1 /* { dg-require-effective-target int32plus } */
2 /* { dg-skip-if "pointers can be truncated" { m32c-*-* } "*" "" } */
3 /* Extracted from GDB sources. */
5 typedef long long bfd_signed_vma;
6 typedef bfd_signed_vma file_ptr;
8 typedef enum bfd_boolean {false, true} boolean;
10 typedef unsigned long long bfd_size_type;
12 typedef unsigned int flagword;
14 typedef unsigned long long CORE_ADDR;
15 typedef unsigned long long bfd_vma;
17 struct bfd_struct {
18 int x;
21 struct asection_struct {
22 unsigned int user_set_vma : 1;
23 bfd_vma vma;
24 bfd_vma lma;
25 unsigned int alignment_power;
26 unsigned int entsize;
29 typedef struct bfd_struct bfd;
30 typedef struct asection_struct asection;
32 static bfd *
33 bfd_openw_with_cleanup (char *filename, const char *target, char *mode);
35 static asection *
36 bfd_make_section_anyway (bfd *abfd, const char *name);
38 static boolean
39 bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val);
41 static boolean
42 bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags);
44 static boolean
45 bfd_set_section_contents (bfd *abfd, asection *section, void * data, file_ptr offset, bfd_size_type count);
47 static void
48 dump_bfd_file (char *filename, char *mode,
49 char *target, CORE_ADDR vaddr,
50 char *buf, int len)
52 bfd *obfd;
53 asection *osection;
55 obfd = bfd_openw_with_cleanup (filename, target, mode);
56 osection = bfd_make_section_anyway (obfd, ".newsec");
57 bfd_set_section_size (obfd, osection, len);
58 (((osection)->vma = (osection)->lma= (vaddr)), ((osection)->user_set_vma = (boolean)true), true);
59 (((osection)->alignment_power = (0)),true);
60 bfd_set_section_flags (obfd, osection, 0x203);
61 osection->entsize = 0;
62 bfd_set_section_contents (obfd, osection, buf, 0, len);
65 static bfd *
66 bfd_openw_with_cleanup (char *filename, const char *target, char *mode)
68 static bfd foo_bfd = { 0 };
69 return &foo_bfd;
72 static asection *
73 bfd_make_section_anyway (bfd *abfd, const char *name)
75 static asection foo_section = { false, 0x0, 0x0, 0 };
77 return &foo_section;
80 static boolean
81 bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val)
83 return true;
86 static boolean
87 bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags)
91 static boolean
92 bfd_set_section_contents (bfd *abfd, asection *section, void * data, file_ptr offset, bfd_size_type count)
94 if (count != (bfd_size_type)0x1eadbeef)
95 abort();
98 static char hello[] = "hello";
100 int main(void)
102 dump_bfd_file(0, 0, 0, (CORE_ADDR)0xdeadbeef, hello, (int)0x1eadbeef);
103 exit(0);