view ticoff/reloc.c @ 88:691551f0635b

armdis: implemented decoding of data processing instructions
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 29 Mar 2014 20:28:13 +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);
}