RTEMS Linker  0.0.1
RTEMS Tools Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
/Users/chris/Development/rtems/src/apps/rtl-host.chrisj/rld-rap.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Chris Johns <chrisj@rtems.org>
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 /**
17  * @file
18  *
19  * @ingroup rtems-ld
20  *
21  * @brief RTEMS Linker RTEMS Application (RAP) Format management.
22  *
23  */
24 
25 #if !defined (_RLD_RAP_H_)
26 #define _RLD_RAP_H_
27 
28 #include <rld-files.h>
29 
30 namespace rld
31 {
32  namespace rap
33  {
34  /**
35  * The RAP relocation bit masks.
36  */
37  #define RAP_RELOC_RELA (1UL << 31)
38  #define RAP_RELOC_STRING (1UL << 31)
39  #define RAP_RELOC_STRING_EMBED (1UL << 30)
40 
41  /**
42  * The sections of interest in a RAP file.
43  */
44  enum sections
45  {
46  rap_text = 0,
47  rap_const = 1,
48  rap_ctor = 2,
49  rap_dtor = 3,
50  rap_data = 4,
51  rap_bss = 5,
53  };
54 
55  /**
56  * Return the name of a section.
57  */
58  const char* section_name (int sec);
59 
60  /**
61  * Write a RAP format file.
62  *
63  * The symbol table is provided to allow incremental linking at some point
64  * in the future. I suspect this will also require extra options being
65  * added to control symbol visibility in the RAP file. For example an
66  * "application" may be self contained and does not need to export any
67  * symbols therefore no symbols are added and the only ones are part of the
68  * relocation records to bind to base image symbols. Another case is the
69  * need for an application to export symbols because it is using dlopen to
70  * load modules. Here the symbols maybe 'all' or it could be a user
71  * maintained list that are exported.
72  *
73  * @param app The application image to write too.
74  * @param init The application's initialisation entry point.
75  * @param fini The application's finish entry point .
76  * @param objects The list of object files in the application.
77  * @param symbols The symbol table used to create the application.
78  */
79  void write (files::image& app,
80  const std::string& init,
81  const std::string& fini,
83  const symbols::table& symbols);
84  }
85 }
86 
87 #endif