diff options
| author | Andrew Chambers <[email protected]> | 2021-10-14 17:03:33 +1300 |
|---|---|---|
| committer | Andrew Chambers <[email protected]> | 2021-10-14 17:03:33 +1300 |
| commit | 4967589e726a760153bb17ae2136c4fc28554d77 (patch) | |
| tree | c1ea0bebf54d2d703fa0709063a08eb741033c9d /main.c | |
| parent | 303d73960d49a67f45d7b653bbeff5b6c0b4efa7 (diff) | |
Never add data to bss.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -58,11 +58,18 @@ static const char *secname(Section *s) { } static void secaddbytes(Section *s, const void *bytes, size_t n) { + + if (s->hdr.sh_type == SHT_NOBITS) { + s->hdr.sh_size += n; + return; + } + while (s->capacity < s->hdr.sh_size + n) { - s->capacity = s->capacity ? (s->capacity * 2) : 64; + s->capacity = s->capacity ? (s->capacity * 2) : 512; s->data = xrealloc(s->data, s->capacity); } memcpy(s->data + s->hdr.sh_size, bytes, n); + s->hdr.sh_size += n; } |
