scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 9e2d324cd450722b5d648374388d2e81322a4bba
parent 6c9b6604b8560c52aa9b3e7dcf308e5294390d7f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 28 Nov 2017 23:22:46 +0100

[objdump] Print relocations in one line format

It helps to scripts

Diffstat:
Mobjdump/main.c | 20+++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/objdump/main.c b/objdump/main.c @@ -175,23 +175,21 @@ printrelocs(struct myrohdr *hdr, FILE *fp) 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; }