aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
Commit message (Collapse)AuthorAgeFilesLines
* fill got table for static linkingAli Gholami Rudi2010-02-051-0/+44
|
* Added patch to detect and use the paths for 64bit libraries asNikos Mavrogiannopoulos2010-01-281-0/+4
| | | | used by CentOS (affects X86_64 only).
* Recognize -Wl,-BsymbolicDetlef Riekenberg2010-01-261-0/+4
| | | | | | | | | | | | | | | Without -Bsymbolic, a symbol/function in a *.so can be overridden by a symbol/function in the main module. That is the default search order, but not supported by tcc. With -Bsymbolic, the linker tries to resolve a symbol/function in the current module first. The loader in tcc implements this search order. We do not distinguish -Bsymbolic and -Bsymbolic-function -- By by ... Detlef
* x86-64: use uplong for symbol valuesgrischka2010-01-141-12/+10
|
* build from multiple objects: fix other targetsgrischka2009-12-201-1/+1
|
* allow tcc be build from separate objectsgrischka2009-12-201-35/+27
| | | | If you want that, run: make NOTALLINONE=1
* win32: enable bounds checker & exception handlergrischka2009-12-191-33/+42
| | | | exception handler borrowed from k1w1. Thanks.
* tcc: add "-Wl,-rpath=path" option (library search path)grischka2009-12-191-1/+4
|
* solve tccelf problem on FreeBSDLuigi Rizzo2009-12-011-10/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Sun, Nov 22, 2009 at 05:43:14PM +0100, Luigi Rizzo wrote: > Hi, > there is a well known problem with tcc and FreeBSD in the generation > of elf objects -- see > http://lists.gnu.org/archive/html/tinycc-devel/2005-07/msg00070.html > > Apparently Sergey Lyubka has tried a partial fix to the problem. > I was wondering if Sergey or someone can post some more detail on > what needs to be done so we can try to help fixing this issue I think i have managed to solve the problem and produce almost valid elf files on FreeBSD. The two patches attached address a few problems (trying to explain to the best of my knowledge; i am not very familiar with ELF and the FreeBSD ELF conventions): 1. ELF file format tcc produces an ELF executable which is good for linux but not for FreeBSD. It misses the PHDR section which is almost mandatory for shared executables, puts in the .dynsym section some relocation info that FreeBSD expects to be in .got, and expect the relocation sections to be contiguous. patch-tccelf.c tries to address the above problem using conditional sections (so hopefully can be imported upstream) and also adds the ability to override the name of the dynamic loader through an environment variable (this is important to debug tcc). 2. predefined macros patch-libtcc.c adds/fixes some predefined macros when compiling on FreeBSD: these are __FreeBSD__ and the usual set of __i386__ and __unix__ variants. It also sets __INTEL_COMPILER so we can grab the __aligned macro from cdefs.h , otherwise many programs would fail The resulting elf file is still not 100% correct -- if you strip it, the program will not run (presumably there is some dangling reference). Other than that, program do seem to run correctly. It would be nice to integrate these patches in the main repository. The FreeBSD specific code is in #ifdef so it should not harm linux users cheers luigi
* Removed binary executable output supportFeret@.(none)2009-11-131-5/+4
| | | | This broke writing executables.
* various fixes and new options for PE formatFrederic Feret2009-11-131-10/+10
|
* added 16-bit x86 assembly supportFrederic Feret2009-11-131-0/+12
|
* add binary executable output supportFrederic Feret2009-11-131-4/+5
|
* fix "symbol not defined" if symbol has offset 0grischka2009-08-241-9/+16
|
* fix some warninggrischka2009-07-181-2/+2
|
* cleanup: constify some global datagrischka2009-07-181-5/+5
|
* tccpe: load dll on the flygrischka2009-07-181-0/+2
|
* win64: fix pointer <-> unsigned long typecast issuesgrischka2009-07-181-6/+6
|
* pe32+ target: add in various #define'sgrischka2009-07-181-1/+8
|
* tccpe: build IAT vector with with -run toogrischka2009-07-181-2/+4
| | | | | This prepares for x86_64 where we need the vector for far jumps. Also, resolve DLL symbols in place
* tccelf: accept BSS symbol with same name from other modulegrischka2009-06-171-1/+2
| | | | ... such as 'int baz;' in two files at the same time
* ulibc: #define TCC_UCLIBC and load elf_interpgrischka2009-05-161-4/+4
|
* fix unused/uninitalized warningsgrischka2009-05-111-0/+2
|
* fix warnings with tcc_add/get_symbolgrischka2009-05-111-1/+1
|
* move some global variables into TCCStategrischka2009-05-111-7/+7
|
* x86-64: Fix tcc -run. We need extra memory for PLT and GOT.Shinichiro Hamaji2009-04-181-3/+5
| | | | Size of the extra buffer is too large for now.
* change tcc_add/get_symbol to use void*grischka2009-04-181-8/+7
|
* x86-64: Remove code for debug print.Shinichiro Hamaji2009-04-181-16/+0
| | | | Now, we concat buffers before relocation. So this only happens when users try creating >2GB binary.
* Work around for the issue TCC doesn't handle -2147483648 properly.Shinichiro Hamaji2009-04-181-1/+1
| | | | | | | | | 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.
* x86-64: Combine buffers of sections before we call tcc_run().Shinichiro Hamaji2009-04-181-27/+3
| | | | | | | - 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...).
* Generate PIC code so that we can create shared objects properly.Shinichiro Hamaji2009-04-181-4/+25
| | | | | | - 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.
* x86-64: Now TCC can create healthy shared objects from object files ↵Shinichiro Hamaji2009-04-181-2/+8
| | | | | | | generated by GCC - Handle R_X86_64_GOTPCREL. - Output R_X86_64_RELATIVE reloc generated from R_X86_64_64.
* x86-64 bug fix: Fix stab generation for x86-64.Shinichiro Hamaji2009-04-181-3/+3
| | | | 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.
* Better DLL support on x86-64.Shinichiro Hamaji2009-04-181-8/+39
| | | | | | | | | | | | - 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.
* First naive DLL support on x86-64.Shinichiro Hamaji2009-04-181-3/+33
| | | | This logic depends on x86_64-gen.c and doesn't work with objects compiled by GCC.
* Add support of x86-64.Shinichiro Hamaji2008-12-021-3/+136
| | | | | | | | | | | | | | | | | | | | | | 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
* silly bug fix: s/#ifdef PTR_SIZE == 4/#if PTR_SIZE == 4/Shinichiro Hamaji2008-12-021-1/+1
|
* Make tccelf.c 64bit ready.Shinichiro Hamaji2008-12-021-9/+20
| | | | | | | - 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.
* Introduce ElfW macro and ELFW to encapsulate the difference between Elf32_* ↵Shinichiro Hamaji2008-12-021-163/+173
| | | | and Elf64_*. Also, introduce ElfW_Rel and SHT_RELX for difference between REL and RELA.
* Allow to use libgcc instead of libtcc1Daniel Glöckner2008-09-121-0/+6
| | | | | | | | | | | | | | | 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
* release loaded dlls cleanly (Sam K)grischka2008-05-051-1/+1
|
* enable pe-output from libtcc (Shmuel Zeigerman)grischka2008-05-051-1/+15
|
* fix stabstr with linked objectsgrischka2008-04-271-1/+31
|
* fix bogus relocations with TCC_OUTPUT_DLLgrischka2008-04-271-2/+17
|
* added verbosity levels (-vv -vvv)grischka2008-03-311-0/+2
|
* Add -soname linker option (Marc Andre Tanner)grischka2008-03-251-3/+58
|
* Fix 'tcc -static' with recent glibcgrischka2008-03-081-6/+10
|
* Switch to newer tccpe.c (includes support for resources)grischka2007-12-191-82/+79
|
* Import 409,410: ARM EABI by Daniel Glöcknergrischka2007-12-041-7/+35
|
* Import more changesets from Rob Landley's fork (part 2)grischka2007-11-211-1/+18
|