Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions doc/outfmt.src
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,20 @@ data for "safe exception handler table" causes no backward
incompatibilities and "safeseh" modules generated by NASM 2.03 and
later can still be linked by earlier versions or non-Microsoft linkers.

\S{win32glob} \c{win32} Extensions to the \c{GLOBAL}, \c{EXTERN} and \c{STATIC} Directives\I{GLOBAL,
win32 extensions to}\I{EXTERN, win32 extensions to}\I{STATIC, win32 extensions to}

You can specify whether a symbol is a function by suffixing the name
with a colon and the word \i\c{function}. For example:

\c global hashlookup:function
\c static localfunc:function
\c extern extfunc:function

The linker may use this extra symbol information when generating tables of
valid indirect branch targets and such.


\S{codeview} Debugging formats for Windows
\I{Windows debugging formats}

Expand Down
22 changes: 19 additions & 3 deletions output/outcoff.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,16 +539,18 @@ static void coff_deflabel(char *name, int32_t segment, int64_t offset,
int pos, section;
struct coff_Symbol *sym;

if (special)
nasm_nonfatal("COFF format does not support any"
" special symbol types");
nasm_debug(2, " coff_deflabel: %s, seg=%"PRIx32", off=%"PRIx64", is_global=%d, %s, coff_nsyms=%"PRIu32"\n",
name, segment, offset, is_global, special, coff_nsyms);

if (name[0] == '.' && name[1] == '.' && name[2] != '@') {
if (strcmp(name,WRT_IMAGEBASE))
nasm_nonfatal("unrecognized special symbol `%s'", name);
return;
}

if (is_global == 3) /* discard special-retry from pass two. */
return;

if (segment == NO_SEG)
section = -1; /* absolute symbol */
else {
Expand Down Expand Up @@ -598,6 +600,20 @@ static void coff_deflabel(char *name, int32_t segment, int64_t offset,
else
sym->value = (sym->section == 0 ? 0 : offset);

if (special) {
special = nasm_skip_spaces(special);
while (*special) {
const char *wend = nasm_skip_word(special);
size_t wlen = wend - special;
if (wlen == 8 && !nasm_strnicmp(special, "function", 8))
sym->type = 0x20; /* DT_FCN */
else
nasm_nonfatal("unrecognised symbol type `%*.*s' on `%s'",
(int)wlen, (int)wlen, special, name);
special = nasm_skip_spaces(wend);
}
}

/*
* define the references from external-symbol segment numbers
* to these symbol records.
Expand Down