blob: f29157a5b1dd26e8e6ce8d6d2bf7d7261cb2ff9a [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001/* TODO:
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
7*/
8
9#include <stdio.h>
10#include <common.h>
11#include <debug.h>
12#include <libelf.h>
13#include <elf.h>
14#include <gelf.h>
15#include <cmdline.h>
16#include <string.h>
17#include <errno.h>
18#include <string.h>
19#include <sys/types.h>
20#include <sys/stat.h>
21#include <fcntl.h>
22#include <unistd.h>
23#include <lsd.h>
24
25/* Flag set by --verbose. This variable is global as it is accessed by the
26 macro INFO() in multiple compilation unites. */
27int verbose_flag = 0;
28/* Flag set by --quiet. This variable is global as it is accessed by the
29 macro PRINT() in multiple compilation unites. */
30int quiet_flag = 0;
31
32int main(int argc, char **argv)
33{
34 char **lookup_dirs = NULL;
35 int num_lookup_dirs;
36 int print_info;
37 int list_needed_libs;
38
39 /* Do not issue INFO() statements before you call get_options() to set
40 the verbose flag as necessary.
41 */
42
43 int first = get_options(argc, argv,
44 &list_needed_libs,
45 &print_info,
46 &lookup_dirs,
47 &num_lookup_dirs,
48 &verbose_flag);
49
50 if (first == argc) {
51 print_help();
52 FAILIF(1, "You must specify at least one input ELF file!\n");
53 }
54
55 /* Check to see whether the ELF library is current. */
56 FAILIF (elf_version(EV_CURRENT) == EV_NONE, "libelf is out of date!\n");
57
58 /* List symbol dependencies... */
59 lsd(&argv[first], argc - first,
60 list_needed_libs, print_info,
61 lookup_dirs, num_lookup_dirs);
62
63 FREE(lookup_dirs);
64
65 return 0;
66}
67