aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Handle r_addend and R_X86_64_PLT32 properly.Shinichiro Hamaji2010-12-281-7/+6
| | | | | | | | | - r_addend should be applied for PLT entries as well - R_X86_64_PLT32 should be handled just like R_X86_64_PC32 - spec says GLOB_DAT and JUMP_SLOT don't need r_addend (not tested) http://www.x86-64.org/documentation/abi.pdf Now we can -run ELF objects generated by GCC.
* tccelf/tcccoff: fix some type conversion warningsgrischka2010-12-041-6/+6
|
* x86_64: finish biarch path fixupHenry Kroll III2010-11-251-1/+1
|
* x86_64: fix --with-libgcc and simplify biarch pathsHenry Kroll III2010-11-251-6/+2
|
* Add support for __FreeBSD_kernel__ kernelThomas Preud'homme2010-09-101-6/+8
| | | | | Add support for kfreebsd-i386 and kfreebsd-amd64 Debian arch with thanks to Pierre Chifflier <chifflier@cpe.fr>.
* Add support for indirect functions as externals.Thomas Preud'homme2010-08-091-6/+8
| | | | Add link support to use indirect functions defined in external modules
* don't discard SHT_((PRE)INIT|FINI)_ARRAY sectionsDaniel Glöckner2010-05-151-0/+3
|
* ARM: add support for R_ARM_V4BXDaniel Glöckner2010-05-151-1/+10
|
* ARM: allow jumps > 32MB on -runDaniel Glöckner2010-05-141-0/+16
| | | | This is needed to reach tinycc's PLT from the compiled program.
* Don't load libtcc1 on arch where it doesn't existThomas Preud'homme2010-05-011-3/+7
| | | | | | | ARM architecture doesn't have any libtcc1 implementation but tcc load libtcc1.a in all case. This patch add a conditional preprocessor instruction to load libtcc1.a only when there is an implementation for the target architecture.
* Link alias symbols togetherThomas Preud'homme2010-05-011-0/+20
| | | | | | | | Make sure alias symbols resolve to the same address in program .bss or .data section. This ensure for example that if a program reference environ (via an extern char **environ declaration) and the libc change its value via the __environ alias after the R_ARCH_COPY relocation have been performed, then the program will see the new value.
* Replace malloc+strcpy by tcc_strdup in ld_load_file_listThomas Preud'homme2010-04-201-9/+3
|
* Fix "already done" test in libname_to_filename()Thomas Preud'homme2010-04-201-1/+1
| | | | if "(libname == '\0')" should be instead "if (libname != '\0')"
* Clean changes introduced by 47abdbdThomas Preud'homme2010-04-201-66/+86
| | | | | | | | | | | | * Replace the save/load_buffer_state by a dynarray approach: - Filename and libname are added to a dynarray when first encountered - Load repeatedly the files in the dynarray until no new undefined symbol are encountered * Replace snprintf by sprintf in libname_to_filename * Use tcc_fileextension in filename_to_libname * Introduce a tcc_strcpy_part fonction to copy only a subset of a string * Move new_undef_syms declaration from tcc.h to tccelf.c
* Better handle ld scriptsThomas Preud'homme2010-04-151-3/+113
| | | | | | | * search file from INPUT and GROUP commands in the library path in addition to the current directory * handle libraries specified by -lfoo options * Search lib in GROUP command repeatedly
* tccelf: fix warninggrischka2010-04-131-0/+2
|
* 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.