Commit Graph

300 Commits

Author SHA1 Message Date
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 Glckner 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
bellard
feed3262c9 fixed libc linking when running in memory 2003-10-04 21:24:46 +00:00
bellard
46169b92d9 .gnu.linkonce section support (useful to link with recent glibc) 2003-10-04 14:45:23 +00:00
bellard
f8d0241764 changed tcc_get_symbol() prototype 2003-07-20 19:19:58 +00:00
bellard
9d95be78c8 added init_array defines for new ld compatibility 2003-05-29 22:52:53 +00:00
bellard
98713a6be3 added -rdynamic support 2003-05-24 15:46:29 +00:00
bellard
8f5e44a439 changed license to LGPL 2003-05-24 14:11:17 +00:00
bellard
c4e6b2e9be alacarte linking (Dave Long) 2003-04-28 22:06:38 +00:00
bellard
2b64f2f570 added -nostdlib 2003-04-27 11:45:01 +00:00
bellard
066d5e7a84 ignore OUTPUT_FORMAT and TARGET ld script commands (fixes Redhat >= 7 static link problems) 2003-04-16 21:25:59 +00:00
bellard
cab6018913 fixed comment parsing 2003-04-13 18:05:51 +00:00
bellard
c2e6daafc1 PLT generation fix 2003-04-13 14:38:05 +00:00
bellard
fa6ac83ec5 FreeBSB fixes - elf align issues 2002-12-08 14:35:48 +00:00
bellard
8901fbeef1 parsing optimizations 2002-11-23 18:15:17 +00:00
bellard
b81d4ba6b3 prepared parser for direct use of file->buf_ptr - faster comment parsing 2002-11-22 23:28:06 +00:00
bellard
2956bd85cd suppressed ch1 and preparser 2002-11-22 18:12:41 +00:00
bellard
e4c7dd5e60 removed many memory leaks - suppressed many global variables 2002-11-02 14:13:21 +00:00
bellard
d8ef07df04 added tcc_relocate() and tcc_get_symbol() 2002-09-08 22:46:32 +00:00
bellard
f946dffd33 suppressed section_ptr - fixed constant string allocation 2002-08-18 14:34:57 +00:00
bellard
3a58c53eaf moved ELF specific stuff to tccelf.c 2002-08-18 13:17:59 +00:00