FreeCalypso > hg > freecalypso-reveng
changeset 127:a314d6aa9bf1
tiobjd: section disasm mode hinting rethought
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 05 Apr 2014 20:00:46 +0000 |
parents | 2c6b1319383b |
children | 03f8a618689e |
files | ticoff/hints.c ticoff/intstruct.h ticoff/tables.c |
diffstat | 3 files changed, 23 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/ticoff/hints.c Sat Apr 05 19:14:43 2014 +0000 +++ b/ticoff/hints.c Sat Apr 05 20:00:46 2014 +0000 @@ -14,7 +14,7 @@ static char *filename_for_err; static int lineno; static struct internal_scnhdr *section; -static struct hint **hint_link; +static struct hint *lasthint; static void set_section(name) @@ -33,13 +33,13 @@ filename_for_err, lineno, name, objfilename); exit(1); } - if (sec->sectype_hint || sec->hints) { + if (sec->hints) { fprintf(stderr, "%s line %d: [%s] given more than once\n", filename_for_err, lineno, name); exit(1); } section = sec; - hint_link = &sec->hints; + lasthint = 0; } static void @@ -54,12 +54,6 @@ filename_for_err, lineno); exit(1); } - if (section->sectype_hint) { - fprintf(stderr, - "%s line %d: mode given more than once for [%s]\n", - filename_for_err, lineno, section->name); - exit(1); - } while (isspace(*arg)) arg++; if (!*arg) { @@ -72,11 +66,11 @@ if (*cp) *cp++ = '\0'; if (!strcmp(arg, "code")) - section->sectype_hint = SECTYPE_CODE; + section->disasm_mode = DISASM_MODE_CODE; else if (!strcmp(arg, "data")) - section->sectype_hint = SECTYPE_DATA; + section->disasm_mode = DISASM_MODE_DATA; else if (!strcmp(arg, "bss")) - section->sectype_hint = SECTYPE_BSS; + section->disasm_mode = DISASM_MODE_BSS; else { fprintf(stderr, "%s line %d: unknown mode \"%s\"\n", filename_for_err, lineno, arg);
--- a/ticoff/intstruct.h Sat Apr 05 19:14:43 2014 +0000 +++ b/ticoff/intstruct.h Sat Apr 05 20:00:46 2014 +0000 @@ -15,13 +15,14 @@ unsigned nsymbols; struct internal_syment **sorted_symbols; struct internal_reloc *int_relocs; - int sectype_hint; + int disasm_mode; struct hint *hints; }; -#define SECTYPE_CODE 1 -#define SECTYPE_DATA 2 -#define SECTYPE_BSS 3 +#define DISASM_MODE_UNKNOWN 0 +#define DISASM_MODE_CODE 1 +#define DISASM_MODE_DATA 2 +#define DISASM_MODE_BSS 3 struct internal_syment { unsigned number;
--- a/ticoff/tables.c Sat Apr 05 19:14:43 2014 +0000 +++ b/ticoff/tables.c Sat Apr 05 20:00:46 2014 +0000 @@ -78,7 +78,18 @@ sections[n].nsymbols = 0; sections[n].sorted_symbols = 0; sections[n].int_relocs = 0; - sections[n].sectype_hint = 0; + if (!strncmp(sections[n].name, ".text", 5)) + sections[n].disasm_mode = DISASM_MODE_CODE; + else if (!strcmp(sections[n].name, ".const")) + sections[n].disasm_mode = DISASM_MODE_DATA; + else if (!strcmp(sections[n].name, ".cinit")) + sections[n].disasm_mode = DISASM_MODE_DATA; + else if (!strcmp(sections[n].name, ".data")) + sections[n].disasm_mode = DISASM_MODE_DATA; + else if (!strcmp(sections[n].name, ".bss")) + sections[n].disasm_mode = DISASM_MODE_BSS; + else + sections[n].disasm_mode = DISASM_MODE_UNKNOWN; sections[n].hints = 0; } }