1 /* Definitions of Module Structures used by ABI version 8
2 Copyright (C) 1993, 1995, 1996, 1997, 2001, 2002, 2003, 2004, 2005,
3 2007, 2009, 2010 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under the
8 terms of the GNU General Public License as published by the Free Software
9 Foundation; either version 3, or (at your option) any later version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>. */
25 #ifndef __objc_private_module_abi_8_INCLUDE_GNU
26 #define __objc_private_module_abi_8_INCLUDE_GNU
28 /* For every class which happens to have statically allocated instances in
29 this module, one OBJC_STATIC_INSTANCES is allocated by the compiler.
30 INSTANCES is NULL terminated and points to all statically allocated
31 instances of this class. */
32 struct objc_static_instances
42 /* Whereas a Module (defined further down) is the root (typically) of a file,
43 a Symtab is the root of the class and category definitions within the
46 A Symtab contains a variable length array of pointers to classes and
47 categories defined in the module. */
50 unsigned long sel_ref_cnt; /* Unknown. */
51 SEL refs; /* Unknown. */
52 unsigned short cls_def_cnt; /* Number of classes compiled (defined)
54 unsigned short cat_def_cnt; /* Number of categories compiled
55 (defined) in the module. */
56 void *defs[1]; /* Variable array of pointers.
57 cls_def_cnt of type Class followed by
58 cat_def_cnt of type Category_t,
59 followed by a NULL terminated array
60 of objc_static_instances. */
63 /* The compiler generates one of these structures for each module that
64 composes the executable (eg main.m).
66 This data structure is the root of the definition tree for the
69 A collect program runs between ld stages and creates a ObjC ctor
70 array. That array holds a pointer to each module structure of the
74 unsigned long version; /* Version of the Module data
76 unsigned long size; /* sizeof(Module) according to the
77 compiler - only used to sanity check
78 that it matches sizeof(Module)
79 according to the runtime. */
80 const char* name; /* Name of the file used to compile the
81 module - not set by modern compilers
82 for security reasons. */
83 struct objc_symtab *symtab; /* Pointer to the Symtab of the module.
84 The Symtab holds an array of pointers
85 to the classes and categories defined
89 /* The compiler generates one of these structures for a class that has
90 instance variables defined in its specification. */
93 const char* ivar_name; /* Name of the instance variable as entered
94 in the class definition. */
95 const char* ivar_type; /* Description of the Ivar's type. Useful
97 int ivar_offset; /* Byte offset from the base address of the
98 instance structure to the variable. */
101 struct objc_ivar_list
103 int ivar_count; /* Number of structures (Ivar)
104 contained in the list. One
105 structure per instance variable
106 defined in the class. */
107 struct objc_ivar ivar_list[1]; /* Variable length structure. */
110 /* The compiler generates one (or more) of these structures for a
111 class that has methods defined in its specification.
113 The implementation of a class can be broken into separate pieces in
114 a file and categories can break them across modules. To handle this
115 problem is a singly linked list of methods. */
118 SEL method_name; /* This variable is the method's name. It
119 is a char*. The unique integer passed
120 to objc_msg_send is a char* too. It is
121 compared against method_name using
123 const char* method_types; /* Description of the method's parameter
124 list. Useful for debuggers. */
125 IMP method_imp; /* Address of the method in the
129 struct objc_method_list
131 struct objc_method_list* method_next; /* This variable is used to
132 link a method list to
133 another. It is a singly
135 int method_count; /* Number of methods defined
136 in this structure. */
137 struct objc_method method_list[1]; /* Variable length
141 /* Currently defined in Protocol.m (that definition should go away
142 once we include this file). */
143 struct objc_method_description_list
146 struct objc_method_description list[1];
149 /* Currently defined by objc/objc.h. */
151 struct objc_protocol {
152 struct objc_class* class_pointer;
154 struct objc_protocol_list *protocol_list;
155 struct objc_method_description_list *instance_methods, *class_methods;
159 struct objc_protocol_list
161 struct objc_protocol_list *next;
167 The compiler generates one of these structures for each class.
169 This structure is the definition for classes.
171 This structure is generated by the compiler in the executable and
172 used by the run-time during normal messaging operations. Therefore
173 some members change type. The compiler generates "char* const" and
174 places a string in the following member variables: super_class.
176 #ifndef __objc_STRUCT_OBJC_CLASS_defined
178 struct objc_class* class_pointer; /* Pointer to the class's meta
180 struct objc_class* super_class; /* Pointer to the super
181 class. NULL for class
183 const char* name; /* Name of the class. */
184 long version; /* Unknown. */
185 unsigned long info; /* Bit mask. See class masks
187 long instance_size; /* Size in bytes of the class.
189 definition and all super
190 class definitions. */
192 /* We pad the structure manually to prevent warning when -Wpadded is
193 used. The compiler automatically pads the structures that it
194 generates, so this manually padded structure still matches the
195 one generated by the compiler, but if we don't pad manually,
196 -Wpadded detects that padding is being added and generates
197 annoying warnings. This hack is necessary as on LLP64 targets
198 sizeof (long) isn't equal to sizeof (void *). */
201 struct objc_ivar_list* ivars; /* Pointer to a structure that
202 describes the instance
203 variables in the class
204 definition. NULL indicates
205 no instance variables.
206 Does not include super
208 struct objc_method_list* methods; /* Linked list of instance
209 methods defined for the
211 struct sarray * dtable; /* Pointer to instance method
213 struct objc_class* subclass_list; /* Subclasses */
214 struct objc_class* sibling_class;
216 struct objc_protocol_list *protocols; /* Protocols conformed to */
217 void* gc_object_type;
219 #endif /* __objc_STRUCT_OBJC_CLASS_defined */
221 /* The compiler generates one of these structures for each category.
222 A class may have many categories and contain both instance and
226 const char* category_name; /* Name of the category.
227 Name contained in the
230 const char* class_name; /* Name of the class to
233 struct objc_method_list *instance_methods; /* Linked list of
237 indicates no instance
239 struct objc_method_list *class_methods; /* Linked list of
245 struct objc_protocol_list *protocols; /* List of Protocols
249 #endif /* __objc_private_module_abi_8_INCLUDE_GNU */