Add support for symbol table in .com files

This change fixes minor bugs and adds a feature, which lets us store the
ELF symbol table, inside the ZIP directory. We use the path /zip/.symtab
which can be safely removed using a zip editing tool, to make the binary
smaller after compilation. This supplements the existing method of using
a separate .com.dbg file, which is still supported. The intent is people
don't always know that it's a good idea to download the debug file. It's
not great having someone's first experience be a crash report, that only
has numbers rather than symbols. This will help fix that!
This commit is contained in:
Justine Tunney 2022-03-23 06:31:55 -07:00
parent 393ca4be40
commit 23b72eb617
61 changed files with 963 additions and 510 deletions

View file

@ -18,6 +18,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/strace.internal.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/sysv/errfuns.h"
@ -29,11 +30,16 @@
* @return 0 on success, or -1 w/ errno
*/
int getrusage(int who, struct rusage *usage) {
if (who == 99) return einval();
if (IsAsan() && !__asan_is_valid(usage, sizeof(*usage))) return efault();
if (!IsWindows()) {
return sys_getrusage(who, usage);
int rc;
if (who == 99) {
rc = einval();
} else if (IsAsan() && !__asan_is_valid(usage, sizeof(*usage))) {
rc = efault();
} else if (!IsWindows()) {
rc = sys_getrusage(who, usage);
} else {
return sys_getrusage_nt(who, usage);
rc = sys_getrusage_nt(who, usage);
}
STRACE("getrusage(%d, %p) → %d% m", who, usage, rc);
return rc;
}