Commit Graph

69 Commits

Author SHA1 Message Date
grischka
f88350b611 fix some warning 2009-07-18 22:07:51 +02:00
grischka
c998985c74 cleanup: constify some global data 2009-07-18 22:07:42 +02:00
grischka
1df662c1b0 tccpe: load dll on the fly 2009-07-18 22:07:25 +02:00
grischka
035918ef2f win64: fix pointer <-> unsigned long typecast issues 2009-07-18 22:05:58 +02:00
grischka
3ea4acb9b9 pe32+ target: add in various #define's 2009-07-18 22:05:27 +02:00
grischka
370cdeb628 tccpe: build IAT vector with with -run too
This prepares for x86_64 where we need the vector
for far jumps.  Also, resolve DLL symbols in place
2009-07-18 21:55:15 +02:00
grischka
bba515afe5 tccelf: accept BSS symbol with same name from other module
... such as 'int baz;' in two files at the same time
2009-06-17 02:08:54 +02:00
grischka
68310299b6 ulibc: #define TCC_UCLIBC and load elf_interp 2009-05-16 22:29:40 +02:00
grischka
03c787d6ce fix unused/uninitalized warnings 2009-05-11 18:46:39 +02:00
grischka
40f5ce002e fix warnings with tcc_add/get_symbol 2009-05-11 18:46:25 +02:00
grischka
f9181416f6 move some global variables into TCCState 2009-05-11 18:45:44 +02:00
Shinichiro Hamaji
9a7173bf69 x86-64: Fix tcc -run. We need extra memory for PLT and GOT.
Size of the extra buffer is too large for now.
2009-04-18 15:08:02 +02:00
grischka
b1697be691 change tcc_add/get_symbol to use void* 2009-04-18 15:08:02 +02:00
Shinichiro Hamaji
85d016b507 x86-64: Remove code for debug print.
Now, we concat buffers before relocation. So this only happens when users try creating >2GB binary.
2009-04-18 15:08:02 +02:00
Shinichiro Hamaji
51a7f163ad Work around for the issue TCC doesn't handle -2147483648 properly.
TCC produces code which is incompatible with GCC for the following code:

    printf("%lld\n", (long long)-2147483648);
    printf("%lld\n", (long long)-2147483649);

For now, just avoid using the corner value.
2009-04-18 15:08:01 +02:00
Shinichiro Hamaji
fcf2e5981f x86-64: Combine buffers of sections before we call tcc_run().
- Now we can run tcc -run tcc.c successfully, though there are some bugs.
- Remove jmp_table and got_table and use text_section for got and plt entries.
- Combine buffers in tcc_relocate().
- Use R_X86_64_64 instead of R_X86_64_32 for R_DATA_32 (now the name R_DATA_32 is inappropriate...).
2009-04-18 15:08:01 +02:00
Shinichiro Hamaji
830b7533c9 Generate PIC code so that we can create shared objects properly.
- Add got_table in TCCState. This approach is naive and the distance between executable code and GOT can be longer than 32bit.
- Handle R_X86_64_GOTPCREL properly. We use got_table for TCC_OUTPUT_MEMORY case for now.
- Fix load() and store() so that they access global variables via GOT.
2009-04-18 15:08:01 +02:00
Shinichiro Hamaji
97072b3cd7 x86-64: Now TCC can create healthy shared objects from object files generated by GCC
- Handle R_X86_64_GOTPCREL.
- Output R_X86_64_RELATIVE reloc generated from R_X86_64_64.
2009-04-18 15:07:10 +02:00
Shinichiro Hamaji
754b0beb7d x86-64 bug fix: Fix stab generation for x86-64.
The size of a stab entry is 12 bytes even in 64bit environments. We must use int instead of long to keep the size of stab entries.
2009-04-18 15:07:09 +02:00
Shinichiro Hamaji
040ef000e4 Better DLL support on x86-64.
- Add a macro TCC_OUTPUT_DLL_WITH_PLT.
-- Now, the DLL with PLT support works only on x86-64, but we may be able to support it on all architectures eventually.
- Define TCC_OUTPUT_DLL_WITH_PLT when target architecture is x86-64.
- Current status (x86-64):
-- Main program should be able to call functions in shared objects.
-- Main program should be able to use global variables in shared objects.
-- Shared objects should be able to call functions in main  program.
-- Shared objects can NOT use global variables in main program.
- To fix the last issue, we may need to add support of -fPIC option in our code generator.
2009-04-18 15:07:09 +02:00
Shinichiro Hamaji
fe8f230ab6 First naive DLL support on x86-64.
This logic depends on x86_64-gen.c and doesn't work with objects compiled by GCC.
2009-04-18 15:07:09 +02:00
Shinichiro Hamaji
0a9873aa22 Add support of x86-64.
Most change was done in #ifdef TCC_TARGET_X86_64. So, nothing should be broken by this change.

Summary of current status of x86-64 support:

- produces x86-64 object files and executables.
- the x86-64 code generator is based on x86's.
-- for long long integers, we use 64bit registers instead of tcc's generic implementation.
-- for float or double, we use SSE. SSE registers are not utilized well (we only use xmm0 and xmm1).
-- for long double, we use x87 FPU.
- passes make test.
- passes ./libtcc_test.
- can compile tcc.c. The compiled tcc can compile tcc.c, too. (there should be some bugs since the binary size of tcc2 and tcc3 is differ where tcc tcc.c -o tcc2 and tcc2 tcc.c -o tcc3)
- can compile links browser. It seems working.
- not tested well. I tested this work only on my linux box with few programs.
- calling convention of long-double-integer or struct is not exactly the same as GCC's x86-64 ABI.
- implementation of tcc -run is naive (tcc -run tcctest.c works, but tcc -run tcc.c doesn't work). Relocating 64bit addresses seems to be not as simple as 32bit environments.
- shared object support isn't unimplemented
- no bounds checker support
- some builtin functions such as __divdi3 aren't supported
2008-12-02 02:30:47 +01:00
Shinichiro Hamaji
ba8c95a98d silly bug fix: s/#ifdef PTR_SIZE == 4/#if PTR_SIZE == 4/ 2008-12-02 02:26:37 +01:00
Shinichiro Hamaji
27d23342ea Make tccelf.c 64bit ready.
- Use REL_SECTION_FMT instead of ".rel%s".
- Use PTR_SIZE instead of sizeof(int) for GOT entries.
- Use sizeof(ElfW(Dyn)) instead of magic number 8.
- Use TCC_ELFCLASS instead of ELFCLASS32.
2008-12-02 02:26:34 +01:00
Shinichiro Hamaji
7dd792ef51 Introduce ElfW macro and ELFW to encapsulate the difference between Elf32_* and Elf64_*. Also, introduce ElfW_Rel and SHT_RELX for difference between REL and RELA. 2008-12-02 02:25:45 +01:00
Daniel Glöckner
15e0dc08a6 Allow to use libgcc instead of libtcc1
This patch adds a switch --with-libgcc to configure.
When passed it prevents libtcc1.a from being built and links to
/lib/libgcc_s.so.1 instead of PREFIX/lib/tcc/libtcc1.a.

It will work on ARM when using libgcc from GCC >= 4.2.0.
Prior versions don't have the __floatun[sd]i[sdx]f functions.

It won't work on i386 because of two missing symbols emitted when
floats are cast to integers, but users can provide those symbols
(global short constants) in their code if needed.

  Daniel
2008-09-12 22:22:58 +02:00
grischka
f9bf48d643 release loaded dlls cleanly (Sam K) 2008-05-05 22:40:49 +00:00
grischka
96bd8f2b25 enable pe-output from libtcc (Shmuel Zeigerman) 2008-05-05 22:39:43 +00:00
grischka
5247bbc2f0 fix stabstr with linked objects 2008-04-27 18:49:31 +00:00
grischka
0d598aca08 fix bogus relocations with TCC_OUTPUT_DLL 2008-04-27 18:48:19 +00:00
grischka
a327c7a552 added verbosity levels (-vv -vvv) 2008-03-31 19:49:14 +00:00
grischka
9bcc0b970b Add -soname linker option (Marc Andre Tanner) 2008-03-25 21:04:47 +00:00
grischka
e2c89576c7 Fix 'tcc -static' with recent glibc 2008-03-08 19:58:57 +00:00
grischka
5342b32eef Switch to newer tccpe.c (includes support for resources) 2007-12-19 17:36:42 +00:00
grischka
f99d3de221 Import 409,410: ARM EABI by Daniel Glöckner 2007-12-04 20:38:09 +00:00
grischka
d778bde7f9 Import more changesets from Rob Landley's fork (part 2) 2007-11-21 17:16:31 +00:00
grischka
2bcc187b1b Fix 'invalid relocation entry' problem on ubuntu - from Bernhard Fischer 2007-10-30 15:13:21 +00:00
bellard
5487bc23c8 tcc_load_dll fix (Tao Wu) 2005-10-30 21:53:14 +00:00
bellard
bb24eb9de4 ignore AS_NEEDED ld command 2005-09-03 21:32:06 +00:00
bellard
fe9b1f60ce win32 merge (grischka) 2005-04-17 13:15:54 +00:00
bellard
d733dc752e better st_other support 2005-04-13 21:37:06 +00:00
bellard
2c538d7a2b initial PE format support 2005-04-10 21:46:58 +00:00
bellard
6bbfb8f610 removed warnings 2004-11-07 15:43:15 +00:00
bellard
c9c05ca5f0 copyright update 2004-10-27 21:38:03 +00:00
bellard
3e74b91de6 correct libtcc1 link order 2004-10-27 21:24:42 +00:00
bellard
38e8a23025 fixed linker symbol generation - output format support 2004-10-23 22:53:42 +00:00
bellard
ff3a5daf25 _end symbol definition fix - fixed section alignment logic 2004-10-18 00:20:26 +00:00
bellard
ec7d36326d C67 COFF executable format support (TK) 2004-10-05 22:33:55 +00:00
bellard
79c72b2419 initial TMS320C67xx support (TK) 2004-10-04 21:57:35 +00:00
bellard
4df5bd2eb0 ARM target support (Daniel Glockner) - allow unsigned char as default on ARM (Daniel Glockner) - fixed small ld script support (Daniel Glockner) 2003-10-14 22:15:56 +00:00