aboutsummaryrefslogtreecommitdiff
path: root/src/libmach/elfnm.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-12-27 17:01:23 +0000
committerrsc <devnull@localhost>2004-12-27 17:01:23 +0000
commite8a7b9699925f3f650593d07eb382155e9374ae6 (patch)
treee176a9718772daf961668100479c9b19e618e65c /src/libmach/elfnm.c
parent2189e55cde473b2a81492759526f824b0ecd227e (diff)
downloadplan9port-e8a7b9699925f3f650593d07eb382155e9374ae6.tar.gz
plan9port-e8a7b9699925f3f650593d07eb382155e9374ae6.tar.bz2
plan9port-e8a7b9699925f3f650593d07eb382155e9374ae6.zip
more features
Diffstat (limited to 'src/libmach/elfnm.c')
-rw-r--r--src/libmach/elfnm.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/libmach/elfnm.c b/src/libmach/elfnm.c
new file mode 100644
index 00000000..9e6d1eac
--- /dev/null
+++ b/src/libmach/elfnm.c
@@ -0,0 +1,38 @@
+#include <u.h>
+#include <libc.h>
+#include <mach.h>
+#include <elf.h>
+
+void
+usage(void)
+{
+ fprint(2, "usage: elfnm file...\n");
+ exits("usage");
+}
+
+void
+main(int argc, char **argv)
+{
+ ElfSym esym;
+ Fhdr *fp;
+ int i, j;
+
+ ARGBEGIN{
+ default:
+ usage();
+ }ARGEND
+
+ if(argc == 0)
+ usage();
+
+ for(i=0; i<argc; i++){
+ if((fp = crackhdr(argv[i], OREAD)) == nil){
+ fprint(2, "%s: %r\n", argv[i]);
+ continue;
+ }
+ for(j=0; elfsym(fp->elf, j, &esym)>=0; j++)
+ print("%s 0x%lux\n", esym.name, esym.value);
+ uncrackhdr(fp);
+ }
+ exits(0);
+}