Add entry point support to as86 backend

I needed entry point support with the as86 format, and after looking through
the archives found a similar desire from someone in 2002.  For some reason
such a patch never made it into the code, even though the required flag
value is present, so I offer the a patch of my own.

I compared against what is done in the .obj format and the approaches are
quite similar which I hope will aid in its acceptability.  While I have
tested it extensively it does do the job asked, and I'm honestly not sure
what extensive testing of the change would look like.
This commit is contained in:
Soronel Haetir 2009-01-03 16:21:52 -09:00 committed by H. Peter Anvin
parent 6cda414a0e
commit e07949dc3f

View file

@ -179,21 +179,31 @@ static int as86_add_string(char *name)
static void as86_deflabel(char *name, int32_t segment, int64_t offset,
int is_global, char *special)
{
int is_start = 0;
struct Symbol *sym;
if (special)
error(ERR_NONFATAL, "as86 format does not support any"
" special symbol types");
if (name[0] == '.' && name[1] == '.' && name[2] != '@') {
error(ERR_NONFATAL, "unrecognised special symbol `%s'", name);
if(strcmp(name, "..start")) {
error(ERR_NONFATAL, "custom unrecognised special symbol `%s'", name);
return;
} else {
is_start = 1;
}
}
sym = saa_wstruct(syms);
sym->strpos = as86_add_string(name);
sym->flags = 0;
if(is_start)
sym->flags = SYM_ENTRY;
if (segment == NO_SEG)
sym->flags |= SYM_ABSOLUTE, sym->segment = 0;
else if (segment == stext.index)