| 1 | = Loader = |
| 2 | |
| 3 | Loader is an utility used to load binary files into platforms. |
| 4 | It holds information about one or more files, and may load any loadable section by its address and size. |
| 5 | |
| 6 | == Usage == |
| 7 | |
| 8 | * {{{Loader( const std::string &filename )}}} |
| 9 | |
| 10 | Creates a new Loader, capable of loading `filename`. |
| 11 | |
| 12 | * {{{void load( void *buffer, uintptr_t address, size_t length )}}} |
| 13 | |
| 14 | `buffer` must be at least `length` bytes long. |
| 15 | |
| 16 | Loads in buffer any segment overlapping memory region between `address` to `address+length`. |
| 17 | Used addresses are LMAs (loading memory address) of sections. |
| 18 | |
| 19 | If a section is too big to fit in the given buffer, it is truncated and a warning is generated to stderr. |
| 20 | |
| 21 | == Handlers == |
| 22 | |
| 23 | Loader does not directly handle different file types. It relies on handlers to support all needed file types. |
| 24 | Your platform must link against needed file loader handler to work properly. |
| 25 | |
| 26 | For instance, to support ELF files, you need to add the following line to your platform_desc: |
| 27 | {{{ |
| 28 | Uses('common:elf_file_loader'), |
| 29 | }}} |