install.texi (gcn): Suggest newer commit for Newlib
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20020404-1.c
blob53b340834005686bb75c79d7a0d6db9c172195ea
1 /* { dg-require-effective-target int32plus } */
2 /* { dg-skip-if "pointers can be truncated" { m32c-*-* } } */
3 /* Extracted from GDB sources. */
5 void abort (void);
6 void exit (int);
8 typedef long long bfd_signed_vma;
9 typedef bfd_signed_vma file_ptr;
11 typedef enum bfd_boolean {false, true} boolean;
13 typedef unsigned long long bfd_size_type;
15 typedef unsigned int flagword;
17 typedef unsigned long long CORE_ADDR;
18 typedef unsigned long long bfd_vma;
20 struct bfd_struct {
21 int x;
24 struct asection_struct {
25 unsigned int user_set_vma : 1;
26 bfd_vma vma;
27 bfd_vma lma;
28 unsigned int alignment_power;
29 unsigned int entsize;
32 typedef struct bfd_struct bfd;
33 typedef struct asection_struct asection;
35 static bfd *
36 bfd_openw_with_cleanup (char *filename, const char *target, char *mode);
38 static asection *
39 bfd_make_section_anyway (bfd *abfd, const char *name);
41 static boolean
42 bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val);
44 static boolean
45 bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags);
47 static boolean
48 bfd_set_section_contents (bfd *abfd, asection *section, void * data, file_ptr offset, bfd_size_type count);
50 static void
51 dump_bfd_file (char *filename, char *mode,
52 char *target, CORE_ADDR vaddr,
53 char *buf, int len)
55 bfd *obfd;
56 asection *osection;
58 obfd = bfd_openw_with_cleanup (filename, target, mode);
59 osection = bfd_make_section_anyway (obfd, ".newsec");
60 bfd_set_section_size (obfd, osection, len);
61 (((osection)->vma = (osection)->lma= (vaddr)), ((osection)->user_set_vma = (boolean)true), true);
62 (((osection)->alignment_power = (0)),true);
63 bfd_set_section_flags (obfd, osection, 0x203);
64 osection->entsize = 0;
65 bfd_set_section_contents (obfd, osection, buf, 0, len);
68 static bfd *
69 bfd_openw_with_cleanup (char *filename, const char *target, char *mode)
71 static bfd foo_bfd = { 0 };
72 return &foo_bfd;
75 static asection *
76 bfd_make_section_anyway (bfd *abfd, const char *name)
78 static asection foo_section = { false, 0x0, 0x0, 0 };
80 return &foo_section;
83 static boolean
84 bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val)
86 return true;
89 static boolean
90 bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags)
94 static boolean
95 bfd_set_section_contents (bfd *abfd, asection *section, void * data, file_ptr offset, bfd_size_type count)
97 if (count != (bfd_size_type)0x1eadbeef)
98 abort();
101 static char hello[] = "hello";
103 int main(void)
105 dump_bfd_file(0, 0, 0, (CORE_ADDR)0xdeadbeef, hello, (int)0x1eadbeef);
106 exit(0);