diff options
| author | grischka <grischka> | 2017-02-13 18:23:43 +0100 |
|---|---|---|
| committer | grischka <grischka> | 2017-02-13 18:23:43 +0100 |
| commit | a4a20360e9df90bb8a0ed23d113ed5564882de8a (patch) | |
| tree | 3115b2a0ce13f54bb56c0b19818623dfdca3bfc4 /tccpe.c | |
| parent | 9817204d8afa37e03035158502ec7b73c72cae50 (diff) | |
| download | tinycc-a4a20360e9df90bb8a0ed23d113ed5564882de8a.tar.gz tinycc-a4a20360e9df90bb8a0ed23d113ed5564882de8a.tar.bz2 | |
fixes & cleanups
- tccgen.c/tcc.h: allow function declaration after use:
int f() { return g(); }
int g() { return 1; }
may be a warning but not an error
see also 76cb1144ef91924c53c57ea71e6f67ce73ce1cc6
- tccgen.c: redundant code related to inline functions removed
(functions used anywhere have sym->c set automatically)
- tccgen.c: make 32bit llop non-equal test portable
(probably not on C67)
- dynarray_add: change prototype to possibly avoid aliasing
problems or at least warnings
- lib/alloca*.S: ".section .note.GNU-stack,"",%progbits" removed
(has no effect)
- tccpe: set SizeOfCode field (for correct upx decompression)
- libtcc.c: fixed alternative -run invocation
tcc "-run -lxxx ..." file.c
(meant to load the library after file).
Also supported now:
tcc files ... options ... -run @ arguments ...
Diffstat (limited to 'tccpe.c')
| -rw-r--r-- | tccpe.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -691,6 +691,10 @@ static int pe_write(struct pe_info *pe) psh->PointerToRawData = file_offset; file_offset = pe_file_align(pe, file_offset + si->data_size); psh->SizeOfRawData = file_offset - psh->PointerToRawData; + if (si->cls == sec_text) + pe_header.opthdr.SizeOfCode += psh->SizeOfRawData; + else + pe_header.opthdr.SizeOfInitializedData += psh->SizeOfRawData; } } @@ -753,7 +757,7 @@ static struct import_symbol *pe_add_import(struct pe_info *pe, int sym_index) } p = tcc_mallocz(sizeof *p); p->dll_index = dll_index; - dynarray_add((void***)&pe->imp_info, &pe->imp_count, p); + dynarray_add(&pe->imp_info, &pe->imp_count, p); found_dll: i = dynarray_assoc ((void**)p->symbols, p->sym_count, sym_index); @@ -761,7 +765,7 @@ found_dll: return p->symbols[i]; s = tcc_mallocz(sizeof *s); - dynarray_add((void***)&p->symbols, &p->sym_count, s); + dynarray_add(&p->symbols, &p->sym_count, s); s->sym_index = sym_index; return s; } @@ -904,7 +908,7 @@ static void pe_build_exports(struct pe_info *pe) p = tcc_malloc(sizeof *p); p->index = sym_index; p->name = name; - dynarray_add((void***)&sorted, &sym_count, p); + dynarray_add(&sorted, &sym_count, p); } #if 0 if (sym->st_other & ST_PE_EXPORT) @@ -1515,7 +1519,7 @@ static int add_dllref(TCCState *s1, const char *dllname) return i + 1; dllref = tcc_mallocz(sizeof(DLLReference) + strlen(dllname)); strcpy(dllref->name, dllname); - dynarray_add((void ***) &s1->loaded_dlls, &s1->nb_loaded_dlls, dllref); + dynarray_add(&s1->loaded_dlls, &s1->nb_loaded_dlls, dllref); return s1->nb_loaded_dlls; } |
