1 #define NULL (void *)0
2
3 struct block
4 {
5 void *function;
6 const struct block *superblock;
7 };
8
9 struct global_block
10 {
11 struct block block;
12 void *compunit_symtab;
13 };
14
15 extern const struct block *block_global_block (const struct block *block);
16
17 void *
18 block_objfile (const struct block *block)
19 {
20 const struct global_block *global_block;
21
22 if (block->function != NULL)
23 return block->function;
24
25 global_block = (struct global_block *) block_global_block (block);
26 return global_block->compunit_symtab;
27 }
28
29 const struct block *
30 block_global_block (const struct block *block)
31 {
32 if (block == NULL)
33 return NULL;
34
35 while (block->superblock != NULL)
36 block = block->superblock;
37
38 return block;
39 }