code whitespace cleanup and patch_relocations() function

This commit is contained in:
asvitkine 2009-11-08 19:11:02 +00:00
parent df4aef1fba
commit f4705aa5e1

View File

@ -483,6 +483,7 @@ void put32(uint32_t *p, uint32_t val)
void gen_code(const char *name, const char *demangled_name,
host_ulong offset, host_ulong size,
FILE *outfile, int gen_switch, const char *prefix);
void patch_relocations(FILE *outfile, const char *name, host_ulong size, host_ulong start_offset);
static void do_print_code(FILE *outfile, const char *name, const uint8_t *code_p, int code_size, int is_code)
{
@ -2055,8 +2056,17 @@ void gen_code(const char *name, const char *demangled_name,
}
/* patch relocations */
patch_relocations(outfile, name, size, start_offset);
fprintf(outfile, " inc_code_ptr(%d);\n", copy_size);
fprintf(outfile, "}\n");
fprintf(outfile, "#endif\n");
fprintf(outfile, "\n");
}
}
void patch_relocations(FILE *outfile, const char *name, host_ulong size, host_ulong start_offset)
{
#if defined(HOST_I386)
{
#ifdef CONFIG_FORMAT_MACH
struct scattered_relocation_info *scarel;
struct relocation_info * rel;
@ -2200,9 +2210,7 @@ void gen_code(const char *name, const char *demangled_name,
}
}
#endif
}
#elif defined(HOST_X86_64)
{
#if defined(CONFIG_FORMAT_MACH)
struct relocation_info * rel;
char final_sym_name[256];
@ -2324,9 +2332,7 @@ void gen_code(const char *name, const char *demangled_name,
#else
#error unsupport object format for HOST_X86_64
#endif
}
#elif defined(HOST_PPC)
{
#ifdef CONFIG_FORMAT_ELF
char final_sym_name[256];
int type;
@ -2468,9 +2474,7 @@ void gen_code(const char *name, const char *demangled_name,
#else
#error unsupport object format
#endif
}
#elif defined(HOST_S390)
{
char final_sym_name[256];
int type;
int addend;
@ -2501,9 +2505,7 @@ void gen_code(const char *name, const char *demangled_name,
}
}
}
}
#elif defined(HOST_ALPHA)
{
for (i = 0, rel = relocs; i < nb_relocs; i++, rel++) {
if (rel->r_offset >= start_offset && rel->r_offset < start_offset + copy_size) {
int type;
@ -2555,9 +2557,7 @@ void gen_code(const char *name, const char *demangled_name,
}
}
}
}
#elif defined(HOST_IA64)
{
char final_sym_name[256];
int type;
int addend;
@ -2577,9 +2577,7 @@ void gen_code(const char *name, const char *demangled_name,
}
}
}
}
#elif defined(HOST_SPARC)
{
char final_sym_name[256];
int type;
int addend;
@ -2642,9 +2640,7 @@ void gen_code(const char *name, const char *demangled_name,
}
}
}
}
#elif defined(HOST_SPARC64)
{
char final_sym_name[256];
int type;
int addend;
@ -2697,9 +2693,7 @@ void gen_code(const char *name, const char *demangled_name,
}
}
}
}
#elif defined(HOST_ARM)
{
char final_sym_name[256];
int type;
int addend;
@ -2731,9 +2725,7 @@ void gen_code(const char *name, const char *demangled_name,
}
}
}
}
#elif defined(HOST_M68K)
{
char final_sym_name[256];
int type;
int addend;
@ -2762,9 +2754,7 @@ void gen_code(const char *name, const char *demangled_name,
}
}
}
}
#elif defined(HOST_MIPS)
{
char final_sym_name[256];
int type;
int addend;
@ -2805,15 +2795,9 @@ void gen_code(const char *name, const char *demangled_name,
}
}
}
}
#else
#error unsupported CPU
#endif
fprintf(outfile, " inc_code_ptr(%d);\n", copy_size);
fprintf(outfile, "}\n");
fprintf(outfile, "#endif\n");
fprintf(outfile, "\n");
}
}
int gen_file(FILE *outfile, int out_type)