Skip to content
Merged
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
2 changes: 2 additions & 0 deletions include/libc/stubinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,6 @@ _Static_assert(sizeof(_GO32_StubInfo) == STUBINFO_END, "size mismatch");
#endif
#endif

#define SIFLG_ELFEXEC (1 << 16)

#endif /* __dj_include_stub_h__ */
15 changes: 8 additions & 7 deletions src/djdev64/stub/stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ int djstub_main(int argc, char *argv[], char *envp[],
int dj32 = 0;
struct dos_ops *ioops = dosops;
uint8_t stub_ver = 0;
#define BARE_STUB() (stub_ver == 0)

if (ver == 0) {
/* backward-compat code */
Expand Down Expand Up @@ -267,6 +266,9 @@ int djstub_main(int argc, char *argv[], char *envp[],
OPEN_DYN();
stubinfo.elfload_arg = atoi(envp[i] + l);
dyn = 1;
/* Not setting emb_ov flags: pfile closed, no payload,
* second loader will re-check everything anyway.
* But we set pl32 below to reserve space for upl. */
} else {
/* 32bit elf */
dj32 = 1;
Expand Down Expand Up @@ -311,6 +313,7 @@ int djstub_main(int argc, char *argv[], char *envp[],
dyn = 1;

emb_ov = 1;
/* calling second ldr */
stubinfo.flags = ((STFLG2_EMBOV) << 8);
stubinfo.flags |= SHM_FLAGS;
nsize = dosops->_dos_seek(ifile, 0, SEEK_END);
Expand All @@ -320,7 +323,9 @@ int djstub_main(int argc, char *argv[], char *envp[],
}
}
if (el || ee) {
pl32 = 1; // even for ELFLOAD we reserve space for pl32
done = 1;
stubinfo.flags |= SIFLG_ELFEXEC;
break;
}
}
Expand Down Expand Up @@ -408,11 +413,6 @@ int djstub_main(int argc, char *argv[], char *envp[],
strncpy(stubinfo.payload2_name, &buf[0x2e], 12);
stubinfo.payload2_name[12] = '\0';
strcat(stubinfo.payload2_name, ".dbg");
} else if (BARE_STUB()) {
done = 1;
ops = &elf_ops;
assert(dyn && pl32);
pl32 = 0;
} else {
error("unsupported stub version %i\n", stub_ver);
return -1;
Expand Down Expand Up @@ -446,6 +446,7 @@ int djstub_main(int argc, char *argv[], char *envp[],
pfile = ifile;
ops = &elf_ops;
}
pl32 = 1;
} else if (is_64) {
error("djstub: 64bit ELF at position %lx\n", coffset);
return -1;
Expand Down Expand Up @@ -522,7 +523,7 @@ int djstub_main(int argc, char *argv[], char *envp[],
if (!dj32 && va_size > MB)
exit(EXIT_FAILURE);
/* if we load 2 payloads, use larger estimate */
if ((dyn && pl32) || BARE_STUB() || compact_va) {
if ((dyn && pl32) || compact_va) {
stubinfo.initial_size = VA_SZ;
stubinfo.upl_base = va;
stubinfo.upl_size = VA_SZ;
Expand Down
6 changes: 0 additions & 6 deletions src/libc/dj64/plt.S
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,6 @@ plt_init:
/* resolve upl */
movl %fs:STUBINFO_ELFLOAD_ARG, %eax
call resolve_upl
// failure is not fatal, just no upl
jc 555f
// eax has uentry
movl $AUX_USER, %ebx
call uplt_init
555:
movl $1, elfload
jmp 11b
222:
Expand Down
Loading