OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20020404-1.c] - Blame information for rev 715

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* Extracted from GDB sources. */
2
 
3
typedef long long bfd_signed_vma;
4
typedef bfd_signed_vma file_ptr;
5
 
6
typedef enum bfd_boolean {false, true} boolean;
7
 
8
typedef unsigned long long bfd_size_type;
9
 
10
typedef unsigned int flagword;
11
 
12
typedef unsigned long long CORE_ADDR;
13
typedef unsigned long long bfd_vma;
14
 
15
struct bfd_struct {
16
        int x;
17
};
18
 
19
struct asection_struct {
20
  unsigned int user_set_vma : 1;
21
  bfd_vma vma;
22
  bfd_vma lma;
23
  unsigned int alignment_power;
24
  unsigned int entsize;
25
};
26
 
27
typedef struct bfd_struct bfd;
28
typedef struct asection_struct asection;
29
 
30
static bfd *
31
bfd_openw_with_cleanup (char *filename, const char *target, char *mode);
32
 
33
static asection *
34
bfd_make_section_anyway (bfd *abfd, const char *name);
35
 
36
static boolean
37
bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val);
38
 
39
static boolean
40
bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags);
41
 
42
static boolean
43
bfd_set_section_contents (bfd *abfd, asection *section, void * data, file_ptr offset, bfd_size_type count);
44
 
45
static void
46
dump_bfd_file (char *filename, char *mode,
47
               char *target, CORE_ADDR vaddr,
48
               char *buf, int len)
49
{
50
  bfd *obfd;
51
  asection *osection;
52
 
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);
61
}
62
 
63
static bfd *
64
bfd_openw_with_cleanup (char *filename, const char *target, char *mode)
65
{
66
        static bfd foo_bfd = { 0 };
67
        return &foo_bfd;
68
}
69
 
70
static asection *
71
bfd_make_section_anyway (bfd *abfd, const char *name)
72
{
73
        static asection foo_section = { false, 0x0, 0x0, 0 };
74
 
75
        return &foo_section;
76
}
77
 
78
static boolean
79
bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val)
80
{
81
        return true;
82
}
83
 
84
static boolean
85
bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags)
86
{
87
}
88
 
89
static boolean
90
bfd_set_section_contents (bfd *abfd, asection *section, void * data, file_ptr offset, bfd_size_type count)
91
{
92
        if (count != (bfd_size_type)0x1eadbeef)
93
                abort();
94
}
95
 
96
static char hello[] = "hello";
97
 
98
int main(void)
99
{
100
        dump_bfd_file(0, 0, 0, (CORE_ADDR)0xdeadbeef, hello, (int)0x1eadbeef);
101
        exit(0);
102
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.