Re: [Tinycc-devel] Minimizing libtcc memory use
> isn't there a garbage collecting done at the end to remove all the unused stuff > to produce a binary that contains only the necessary parts ? That very well might be the case, but given that tcc_get_symbol() can be used at any time between tcc_relocate() and tcc_delete(), it follows that _at least_ symbols are resident in the TCCState. What I'm wondering about is the feasibility of keeping just code and data, and flushing everything else. This would require a new API - something like tcc_finalize(TCCState *) or perhaps tcc_finalize(TCCState *, flags), where flags specify what to flush. I don't know enough about the internals, but if I'm willing to run with CONFIG_RUNMEM_RO, it seems like the per TCCState memory use in my case could be decreased from something like 29K to 1K or 2K. I should mention that the memory usage in my case is 29K regardless of whether CONFIG_RUNMEM_RO is 0 or 1. Thanks - Eric ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] TCC compiling TCC
On 02.03.2024 20:15, Jake Anderson wrote: When compiling TCC using TCC, there is an error about missing _strtoui64 in msvcrt.dll on Windows 2000 and older. This does not occur when using old versions of GCC to compile TCC. Maybe you want to replace in tcc.h # define strtoull _strtoui64 by # define strtoull strtoul You just cannot use 64-bit numbers in the assembler then. -- gr ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] tcc assembler emits wrong pc-relative symbol difference reloctions in immediates
On 01.03.2024 17:32, Rich Felker wrote: The relocation emitted is the pc-relative address based on the beginning of the add opcode, but it needs to be based on the beginning of the immediate operand in the add opcode. I just moved the addition of (ind + 4) https://repo.or.cz/tinycc.git/commitdiff/ca061f3a96216f85f6fe72868083208aa0a740b9#patch2 to where the operand is put. https://repo.or.cz/tinycc.git/commitdiff/ca061f3a96216f85f6fe72868083208aa0a740b9#patch1 thanks, -- gr diff --git a/i386-asm.c b/i386-asm.c index e134d804..63cfbf6b 100644 --- a/i386-asm.c +++ b/i386-asm.c @@ -738,6 +738,8 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) s = 0; /* avoid warning */ +int ind0 = ind; + again: /* optimize matching by using a lookup table (no hashing is needed !) */ @@ -1153,6 +1155,7 @@ again: } else if (pa->op_type[i] == OPT_DISP || pa->op_type[i] == OPT_DISP8) { gen_disp32([i].e); } else { +if (ops[i].e.pcrel) ops[i].e.v += ind-ind0; gen_expr32([i].e); } } Please CC me on replies, as I'm not subscribed. Rich ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel