aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
Commit message (Collapse)AuthorAgeFilesLines
* Adjust relocation offset for thumb to ARM veneerThomas Preud'homme2014-03-111-1/+1
|
* Fix warning of clangThomas Preud'homme2014-03-091-20/+20
|
* Call fill_got_entry unconditionallyThomas Preud'homme2014-02-101-2/+0
| | | | | | Call fill_got_entry unconditionally from fill_got so as to avoid warnings on !x86-64 architectures. This can be done since this code path is only followed by x86-64 architecture anyway.
* Add support of Thumb to ARM branch relocationThomas Preud'homme2014-02-061-0/+28
|
* Split elf_output_file in smaller functionsThomas Preud'homme2014-02-061-544/+652
|
* Add macro to browse reloc and sym entriesThomas Preud'homme2014-02-061-79/+39
| | | | | Introduce for_each_elem to browse relocation entries and symbols of a section.
* Revert "Add macro to browse reloc and sym entries"Thomas Preud'homme2014-02-021-37/+77
| | | | This reverts commit 3cbc7a2dccf13b96c572623582d6c54394f98c36.
* Revert "Split elf_output_file in smaller functions"Thomas Preud'homme2014-02-021-652/+544
| | | | This reverts commit b5b82df3e388e2565ee424994e3d5041fbf91161.
* Revert "Add support of Thumb to ARM branch relocation"Thomas Preud'homme2014-02-021-28/+0
| | | | This reverts commit 8635939b8d902244679cb1a024190fa37a4fed10.
* Add support of Thumb to ARM branch relocationThomas Preud'homme2014-02-021-0/+28
|
* Split elf_output_file in smaller functionsThomas Preud'homme2014-02-021-544/+652
|
* Add macro to browse reloc and sym entriesThomas Preud'homme2014-02-021-77/+37
| | | | | Introduce for_each_elem to browse relocation entries and symbols of a section.
* Give ARM asm mnemonic of PLT entriesThomas Preud'homme2014-02-021-9/+9
| | | | Give ARM assembly mnemonic of PLT entries in put_got_entry
* Clean tccelf.cThomas Preud'homme2014-02-021-199/+179
| | | | | | | - remove debug printf and commented out code - remove C++-like comments - remove whitespace at end of lines - replace tabs by spaces
* Remove WITHOUT_LIBTCC macro: no more userThomas Preud'homme2014-01-081-3/+1
|
* Shared libraries also have entry pointsThomas Preud'homme2014-01-081-1/+1
| | | | This fix commit 32734680cb2a645d48f806edae5a5912e0759a23
* Improve ELF on ARMThomas Preud'homme2014-01-081-1/+7
| | | | | * set whether soft or hardfloat calling convention is used * mark ELF file has having an entry point when there is
* Update elf.hThomas Preud'homme2014-01-081-10/+10
|
* Add support for runtime selection of float ABIThomas Preud'homme2014-01-081-1/+1
|
* i386: use __fixdfdi instead of __tcc_cvt_ftolgrischka2014-01-061-2/+2
| | | | | | | | | | | | Variants __fixsfdi/__fixxfdi are not needed for now because the value is converted to double always. Also: - remove __tcc_fpinit for unix as it seems redundant by the __setfpucw call in the startup code - avoid reference to s->runtime_main in cross compilers - configure: fix --with-libgcc help - tcctok.h: cleanup
* Use libtcc.a for static link even with USE_LIBGCCThomas Preud'homme2014-01-031-1/+6
| | | | | | | When statically linking, runtime library should be static as well. tcc could link with libgcc.a but it's in a gcc version specific directory. Another solution, followed by this patch, is to use libtcc.a when statically linking, even if USE_LIBGCC was configured.
* Allow thumb transition for R_ARM_PC24Thomas Preud'homme2013-11-181-12/+13
| | | | | Allow bl -> blx conversion in the case of R_ARM_PC24 relocation with instruction being an unconditional bl. Also make spacing more uniform.
* Revert "Add support for thread-local storage variables"Thomas Preud'homme2013-11-031-21/+8
| | | | | | | | | | TLS support in tinyCC is absolutely not ready: - segment register not select in load and store - no relocation added for computing offset of per-thread symbol - no support for TLS-specific relocations - no program header added as per Drepper document about TLS This reverts commit 1c4afd13501f07a673aed5f130166f2ee0f30927.
* Add support for thread-local storage variablesThomas Preud'homme2013-10-291-8/+21
|
* add version number to manpageUrs Janssen2013-02-171-1/+1
| | | | | | | avoid c++/c99 style comments in preprocessor directives avoid leadings whitespaces in preprocessor directives mention implemented variable length arrays in documentation fixed ambiguous option in texi2html call (Austin English)
* libtcc: new LIBTCCAPI tcc_set_options(TCCState*, const char*str)grischka2013-02-121-1/+1
| | | | | | | | | | | | | | | | | | | This replaces -> use instead: ----------------------------------- - tcc_set_linker -> tcc_set_options(s, "-Wl,..."); - tcc_set_warning -> tcc_set_options(s, "-W..."); - tcc_enable_debug -> tcc_set_options(s, "-g"); parse_args is moved to libtcc.c (now tcc_parse_args). Also some cleanups: - reorder TCCState members - add some comments here and there - do not use argv's directly, make string copies - use const char* in tcc_set_linker - tccpe: use fd instead of fp tested with -D MEM_DEBUG: 0 bytes left
* tcc.h: declare CValue.tab[LDOUBLE_SIZE/4]grischka2013-02-081-7/+7
| | | | | | | | Should fix some warnings wrt. access out of array bounds. tccelf.c: fix "static function unused" warning x86_64-gen.c: fix "ctype.ref uninitialzed" warning and cleanup tcc-win32.txt: remove obsolete limitation notes.
* lib/Makefile: use CC, add bcheck to libtcc1.agrischka2013-02-061-4/+0
| | | | | | | | Also: - fix "make tcc_p" (profiling version) - remove old gcc flags: -mpreferred-stack-boundary=2 -march=i386 -falign-functions=0 - remove test "hello" for Darwin (cannot compile to file)
* tccelf: fix debug section relocationgrischka2013-02-051-1/+1
| | | | | | | | | | | | With: tcc -g hello.c gdb a.out b main gdb refused to know "main" because of broken dwarf info. This partially reverts commit 0d598aca087e46ea67f97dda50df3eed522d5e7a. I don't remember what the problem was but it was the wrong way to fix it.
* portability: make tcc_get_symbol() available for non-nativegrischka2013-02-041-2/+2
| | | | | For consistency with tcc_add_symbol(). Use uintptr_t here also.
* portability: fix void* <-> target address conversion confusiongrischka2013-02-041-37/+40
| | | | | | - #define addr_t as ElfW(Addr) - replace uplong by addr_t - #define TCC_HAS_RUNTIME_PLTGOT and use it
* Revert "Don't call elf_hash on NULL value"Thomas Preud'homme2013-01-311-1/+1
| | | | This reverts commit 505329b5b3ee4cb47d0a3590ccd62a65dbf83fc9.
* safety: replace occurrences of strcpy by pstrcpygrischka2013-01-311-16/+6
|
* Don't call elf_hash on NULL valueDomingo Alvarez Duarte2013-01-311-1/+1
| | | | | | Make sur elf_hash is never invoked with a NULL value. Signed-off-by: Thomas Preud'homme <robotux@celest.fr>
* Fix overflow detection in ARM relocationThomas Preud'homme2013-01-281-2/+2
| | | | | | Fix overflow detection for R_ARM_CALL, R_ARM_PC24, R_ARM_JUMP24 and R_ARM_PLT32 relocations on ARM. 26 bits means 25 bits for positive and negative offsets !
* Link STT_GNU_IFUNC into STT_FUNC in executable.Thomas Preud'homme2013-01-251-2/+11
| | | | | | | | Indirect functions shall have STT_FUNC type in executable dynsym section. Indeed, a dlsym call following a lazy resolution would pick the symbol value from the executable dynsym entry. This would contain the address of the function wanted by the caller of dlsym instead of the address of the function that would return that address.
* Revert "Added what I call virtual io to tinycc this way we can make a ↵Thomas Preud'homme2013-01-141-21/+22
| | | | | | | | monolitic executable or library that contains all needed to compile programs, truly tinycc portable." This reverts commit 59e18aee0e509a3ca75dbe6f909e18c1d17893d1. tcc is being stabilized now in order to do a new release soon. Therefore, such a change is not appropriate now.
* Added what I call virtual io to tinycc this way we can make a monolitic ↵mingodad2013-01-111-22/+21
| | | | | | executable or library that contains all needed to compile programs, truly tinycc portable. Tested under linux exec the "mk-it" shell script and you'll end up with a portable tinycc executable that doesn't depend on anything else.
* Generate PLT thumb stub only when necessaryThomas Preud'homme2012-11-171-25/+41
| | | | | | Generate PLT thumb stub for an ARM PLT entry only when at least one Thumb instruction branches to that entry. This is a rewrite of the previous patch.
* Revert "Generate PLT thumb stub only when necessary"Thomas Preud'homme2012-11-121-53/+23
| | | | | | | Revert commit 891dfcdf3fc441a1863c43d179dc6e0e4d65836f since it assumes *all* architectures supported by tcc have GOT offsets aligned on 2. A rework of this commit is being done since without it all PLT entries grow by 4 bytes.
* Call to veneers in ARM modeThomas Preud'homme2012-11-091-1/+3
| | | | | | | | Since commit c6630ef92a21ca33af08b1faa03fba578e12315f, Call to a veneer when the final symbol to be reached is thumb is made through a blx instruction. This is a mistake since veneers are ARM instructions and should thus be called with a simple bl. This commit prevent the bl -> blx conversion when a veneer is used.
* Generate PLT thumb stub only when necessaryThomas Preud'homme2012-11-071-23/+53
| | | | | | | | | | | Generate PLT thumb stub for an ARM PLT entry only when at least one Thumb instruction branches to that entry. Warning: To save space, this commit reuses the bit 0 of entries of got_offsets array. The GOT offset is thus saved in a 31 bit value. Make sure to divide by 2 (right shift by 1) an offset before storing it there and conversely to multiply the value by 2 (left shift by 1) before using it.
* Support R_ARM_THM_JUMP24 relocation to pltThomas Preud'homme2012-11-071-8/+18
| | | | | | Add thumb stubs switching from thumb mode to arm mode to *all* PLT entries so that R_ARM_THM_JUMP24 relocations to PLT entries can be satisfied.
* Add support for R_ARM_THM_{JUMP24,CALL} relocsThomas Preud'homme2012-10-281-0/+64
| | | | | | Add support for relocations R_ARM_THM_JUMP24 and R_ARM_THM_CALL. These are encountered with gcc when compiling for armv6 or greater with -mthumb flag and a call (conditional or not) is done.
* Only use blx if availableThomas Preud'homme2012-10-161-8/+11
| | | | | | | | Introduce ARM version for the target architecture in order to determine if blx instruction can be used or not. Availability of blx instruction allows for more scenarii supported in R_ARM_CALL relocation. It should also be useful when introducing support for the R_ARM_THM_CALL relocation.
* Fix R_ARM_CALL when target fonction is ThumbThomas Preud'homme2012-10-101-4/+12
| | | | | | With R_ARM_CALL, if target function is to be entered in Thumb mode, the relocation is supposed to transform bl in blx. This is not the case actually so this commit is there to fix it.
* Support for R_ARM_[THM_]MOV{W,T}_ABS[_NC} relocsThomas Preud'homme2012-10-101-0/+32
| | | | | | | | | Add support for relocations R_ARM_MOVW_ABS_NC and R_ARM_MOVT_ABS as well as their Thumb2 counterpart R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_ABS. These are encountered with gcc when compiling for armv7-a and a data is loaded in a register, either in arm or Thumb2 mode. The first half of the data is loaded with movw ; the second half is loaded with movt.
* Fix R_ARM_REL32 relocationThomas Preud'homme2012-07-091-0/+1
| | | | Add missing break in the code handling R_ARM_REL32 relocation.
* tccelf.c: Add R_ARM_REL32 relocationThomas Preud'homme2012-06-051-0/+2
|
* libtcc: tcc_get_symbol uses the TCCState parametergrischka2012-04-181-2/+2
| | | | | This allows using tcc_get_symbol on some other than the current TCCState. (Suggested by David Mertens)