Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always emit an absolute @feat.00 symbol for CFG support #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 11 additions & 4 deletions output/outcoff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,8 @@ static void coff_write(void)
/* fill in the .drectve section with -export's */
BuildExportTable(&Exports);

if (win32) {
/* add default value for @feat.00, this allows to 'link /safeseh' */
/* Emit an absolute @feat.00 symbol */
{
uint32_t n;

saa_rewind(coff_syms);
Expand All @@ -1052,8 +1052,15 @@ static void coff_write(void)
if (sym->strpos == -1 && !strcmp("@feat.00",sym->name))
break;
}
if (n == coff_nsyms)
coff_deflabel("@feat.00", NO_SEG, 1, 0, NULL);
if (n == coff_nsyms) {
int64_t feat00_flags = 0;
if (win32)
/* marks the object for "registered SEH". this allows to 'link /safeseh' */
feat00_flags |= 1;

feat00_flags |= 0x800; /* object is CFG-aware */
coff_deflabel("@feat.00", NO_SEG, feat00_flags, 0, NULL);
}
}

/*
Expand Down