2 1. check the ARM EABI version--this works for versions 1 and 2.
3 2. use a more-intelligent approach to finding the symbol table, symbol-string
4 table, and the .dynamic section.
5 3. fix the determination of the host and ELF-file endianness
6 4. write the help screen
14 #ifdef ARM_SPECIFIC_HACKS
15 #include <libebl_arm.h>
16 #endif/*ARM_SPECIFIC_HACKS*/
22 #include <sys/types.h>
26 #include <rangesort.h>
27 #include <prelink_info.h>
31 /* Flag set by --verbose. This variable is global as it is accessed by the
32 macro INFO() in multiple compilation unites. */
34 /* Flag set by --quiet. This variable is global as it is accessed by the
35 macro PRINT() in multiple compilation unites. */
38 int main(int argc, char **argv) {
44 /* Check to see whether the ELF library is current. */
45 FAILIF (elf_version(EV_CURRENT) == EV_NONE, "libelf is out of date!\n");
48 for (; argc; argc--) {
55 long prelink_addr = 0;
57 INFO("Processing file [%s]\n", filename);
59 fd = open(filename, O_RDONLY);
60 FAILIF(fd < 0, "open(%d): %s (%d).\n",
65 elf = elf_begin(fd, ELF_C_READ_MMAP_PRIVATE, NULL);
66 FAILIF_LIBELF(elf == NULL, elf_begin);
68 FAILIF_LIBELF(0 == gelf_getehdr(elf, &elf_hdr),
71 #ifdef SUPPORT_ANDROID_PRELINK_TAGS
72 prelinked = check_prelinked(filename, elf_hdr.e_ident[EI_DATA] == ELFDATA2LSB,
75 #error 'SUPPORT_ANDROID_PRELINK_TAGS is not defined!'
79 PRINT("%s: 0x%08x\n", filename, prelink_addr);
81 PRINT("%s: not prelinked\n", filename);
83 FAILIF_LIBELF(elf_end(elf), elf_end);