view ticoff/reloc.c @ 103:a10acb1688e0

thumbdis: buglet in the decoding of sub-from-sp
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 31 Mar 2014 01:59:28 +0000
parents c20dc315a9d4
children e650fdc743fe
line wrap: on
line source

/*
 * Handling of relocation records
 */

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include "filestruct.h"
#include "intstruct.h"
#include "globals.h"

extern unsigned get_u16(), get_u32();

cmd_rawrel()
{
	unsigned n, m;
	struct internal_scnhdr *sec;
	struct external_reloc *rel;

	get_int_section_table();
	for (n = 0; n < nsections; n++) {
		sec = sections + n;
		if (!sec->nreloc)
			continue;
		printf("%s:\n\n", sec->name);
		rel = (struct external_reloc *)(filemap + sec->reloc_offset);
		printf("Location  SymIndex  Rsvd  Type\n");
		for (m = 0; m < sec->nreloc; m++, rel++)
			printf("%08X  %08X  %04X  %04X\n",
				get_u32(rel->r_vaddr), get_u32(rel->r_symndx),
				get_u16(rel->r_reserved), get_u16(rel->r_type));
		putchar('\n');
	}
	exit(0);
}