mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-27 04:50:28 +00:00
Hunt down some small bugs
This commit is contained in:
parent
95b142e4e5
commit
830334d767
15 changed files with 1156 additions and 83 deletions
|
@ -163,7 +163,6 @@ int main(int argc, char *argv[]) {
|
|||
CONCAT(&filenames.p, &filenames.i, &filenames.n, "/\n", 2);
|
||||
CHECK_NE(MAP_FAILED,
|
||||
(elf = mmap(NULL, st->st_size, PROT_READ, MAP_PRIVATE, fd, 0)));
|
||||
madvise(elf, st->st_size, MADV_WILLNEED);
|
||||
CHECK(IsElf64Binary(elf, st->st_size));
|
||||
CHECK_NOTNULL((strs = GetElfStringTable(elf, st->st_size)));
|
||||
CHECK_NOTNULL((syms = GetElfSymbolTable(elf, st->st_size, &symcount)));
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "libc/alg/arraylist2.internal.h"
|
||||
#include "libc/bits/safemacros.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/str/knuthmultiplicativehash.internal.h"
|
||||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "tool/build/lib/interner.h"
|
||||
|
@ -100,7 +100,7 @@ size_t internobj(struct Interner *t, const void *data, size_t size) {
|
|||
step = 0;
|
||||
item = data;
|
||||
it = (struct InternerObject *)t;
|
||||
hash = max(1, KnuthMultiplicativeHash32(data, size));
|
||||
hash = max(1, crc32c(0, data, size));
|
||||
do {
|
||||
/* it is written that triangle probe halts iff i<n/2 && popcnt(n)==1 */
|
||||
i = (hash + step * ((step + 1) >> 1)) & (it->n - 1);
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "libc/runtime/gc.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/knuthmultiplicativehash.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/madv.h"
|
||||
#include "libc/sysv/consts/map.h"
|
||||
|
|
|
@ -41,7 +41,7 @@ nodiscard char *tabpad(const char *s, unsigned width) {
|
|||
size_t i, l, need;
|
||||
l = strlen(s);
|
||||
need = width > l ? (roundup(width, 8) - l - 1) / 8 + 1 : 0;
|
||||
p = memcpy(malloc(l + need + 1), s, l);
|
||||
p = memcpy(malloc(l + need + 2), s, l);
|
||||
for (i = 0; i < need; ++i) p[l + i] = '\t';
|
||||
if (!need) {
|
||||
p[l] = ' ';
|
||||
|
|
|
@ -221,6 +221,7 @@ const struct IdName kElfSpecialSectionNames[] = {
|
|||
};
|
||||
|
||||
const struct IdName kElfNexgen32eRelocationNames[] = {
|
||||
{R_X86_64_NONE, "NONE"},
|
||||
{R_X86_64_64, "64"},
|
||||
{R_X86_64_PC32, "PC32"},
|
||||
{R_X86_64_GOT32, "GOT32"},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue