Skip to content

Commit

Permalink
thunks: make cthunks buildable with gcc [#225]
Browse files Browse the repository at this point in the history
  • Loading branch information
stsp committed Jan 2, 2025
1 parent b720977 commit 02c0f51
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions fdpp/thunks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ void FdppLoaderHook(uint16_t seg, int (*getsymoff)(void *, const char *),
int off = getsymoff(arg, asm_cthunks[i].name);
assert(off != -1);
assert(asm_cthunks[i].name);
asm_tab[i].seg = seg;
asm_tab[i].off = off;
asm_tab[asm_cthunks[i].num].seg = seg;
asm_tab[asm_cthunks[i].num].off = off;
}

f.off = getsymoff(arg, "near_wrp");
Expand Down
6 changes: 3 additions & 3 deletions fdpp/thunks_a.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ struct athunk asm_thunks[] = {

const int num_athunks = _countof(asm_thunks);

struct athunk asm_cthunks[] = {
#define ASMCSYM(s, n) [n] = { _S(_##s), NULL, 0 },
struct cthunk asm_cthunks[] = {
#define ASMCSYM(s, n) { _S(_##s), n, NULL },
#include "plt_asmc.h"
#define ASMPSYM(s, n) [n] = { _S(s), NULL, 0 },
#define ASMPSYM(s, n) { _S(s), n, NULL },
#include "plt_asmp.h"
};

Expand Down
8 changes: 7 additions & 1 deletion fdpp/thunks_a.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ struct athunk {
unsigned flags;
};

struct cthunk {
const char *name;
int num;
struct far_s *ptr;
};

extern struct athunk asm_thunks[];
extern const int num_athunks;
extern struct athunk asm_cthunks[];
extern struct cthunk asm_cthunks[];
extern const int num_cthunks;
extern far_t asm_tab[];

0 comments on commit 02c0f51

Please # to comment.