[eb825b1] | 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 | { |
---|
[39f48c9] | 34 | /** |
---|
| 35 | * Output details or not. |
---|
| 36 | */ |
---|
| 37 | extern bool add_obj_details; |
---|
| 38 | |
---|
[59c3ebd] | 39 | /** |
---|
| 40 | * Store the path of object files. |
---|
| 41 | */ |
---|
| 42 | extern std::string rpath; |
---|
| 43 | |
---|
[6c28ffb] | 44 | /** |
---|
| 45 | * The RAP relocation bit masks. |
---|
| 46 | */ |
---|
| 47 | #define RAP_RELOC_RELA (1UL << 31) |
---|
| 48 | #define RAP_RELOC_STRING (1UL << 31) |
---|
| 49 | #define RAP_RELOC_STRING_EMBED (1UL << 30) |
---|
| 50 | |
---|
| 51 | /** |
---|
| 52 | * The sections of interest in a RAP file. |
---|
| 53 | */ |
---|
| 54 | enum sections |
---|
| 55 | { |
---|
| 56 | rap_text = 0, |
---|
| 57 | rap_const = 1, |
---|
| 58 | rap_ctor = 2, |
---|
| 59 | rap_dtor = 3, |
---|
| 60 | rap_data = 4, |
---|
| 61 | rap_bss = 5, |
---|
| 62 | rap_secs = 6 |
---|
| 63 | }; |
---|
| 64 | |
---|
| 65 | /** |
---|
| 66 | * Return the name of a section. |
---|
| 67 | */ |
---|
| 68 | const char* section_name (int sec); |
---|
| 69 | |
---|
[eb825b1] | 70 | /** |
---|
| 71 | * Write a RAP format file. |
---|
[ae353d3] | 72 | * |
---|
| 73 | * The symbol table is provided to allow incremental linking at some point |
---|
| 74 | * in the future. I suspect this will also require extra options being |
---|
| 75 | * added to control symbol visibility in the RAP file. For example an |
---|
| 76 | * "application" may be self contained and does not need to export any |
---|
| 77 | * symbols therefore no symbols are added and the only ones are part of the |
---|
| 78 | * relocation records to bind to base image symbols. Another case is the |
---|
| 79 | * need for an application to export symbols because it is using dlopen to |
---|
| 80 | * load modules. Here the symbols maybe 'all' or it could be a user |
---|
| 81 | * maintained list that are exported. |
---|
| 82 | * |
---|
| 83 | * @param app The application image to write too. |
---|
[803c60a] | 84 | * @param init The application's initialisation entry point. |
---|
[e78e2b0] | 85 | * @param fini The application's finish entry point . |
---|
[ae353d3] | 86 | * @param objects The list of object files in the application. |
---|
| 87 | * @param symbols The symbol table used to create the application. |
---|
[eb825b1] | 88 | */ |
---|
| 89 | void write (files::image& app, |
---|
[803c60a] | 90 | const std::string& init, |
---|
| 91 | const std::string& fini, |
---|
[eb825b1] | 92 | const files::object_list& objects, |
---|
| 93 | const symbols::table& symbols); |
---|
| 94 | } |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | #endif |
---|