ref: fcf6344abaab925b58476fb5e9039b5b6deee11e
parent: 64688dc02ba9cc803d2b2a8b6030d73602ed18cc
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Nov 28 18:22:46 EST 2017
[objdump] Print relocations in one line format It helps to scripts
--- a/objdump/main.c
+++ b/objdump/main.c
@@ -175,23 +175,21 @@
unsigned long long n, i;
struct myrorel rel;
- puts("relocs:");
+ printf("relocs:\n"
+ " [Nr]\t%-16s\tType\tId\tSize\tNbits\tShift\n",
+ "Offset");
n = hdr->relsize / MYROREL_SIZ;
for (i = 0; i < n; ++i) {
if (rdmyrorel(fp, &rel) < 0)
return -1;
- printf("\tid: %lu\n"
- "\tflags: %x\n"
- "\tsize: %u\n"
- "\tnbits: %u\n"
- "\tshift: %u\n"
- "\toffset: %llu\n",
- rel.id,
- rel.flags,
+ printf(" [%2d]\t%016llX\t%s\t%lu\t%u\t%u\t%u\n",
+ i,
+ rel.offset,
+ (rel.id & 1<<31) ? "section" : "symbol",
+ rel.id & ~(1<<31),
rel.size,
rel.nbits,
- rel.shift,
- rel.offset);
+ rel.shift);
}
return 0;
}