aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
Commit message (Collapse)AuthorAgeFilesLines
* 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)
* tcc_realloc: auto "memory full" errorgrischka2012-04-181-2/+0
|
* Fix assumption of 32bit long on portions of ElfAndrew Mulbrook2012-03-031-8/+9
| | | | | | | | | Modify tcc to accept convert full 64bits of specified text section when converting on Win64. Write high bytes to the elf section address as well. This allows creation of elf binaries located in offsets using full 64 bit addresses. Signed-off-by: Andrew Mulbrook <andrew262@gmail.com>
* Revert "Multiple fixes for 64 bit sections"Andrew Mulbrook2012-03-031-13/+8
| | | | This reverts commit d7a7c3769d0a1dcb8400258cd8adf78a8566de61.
* Multiple fixes for 64 bit sectionsmob2012-02-261-8/+13
| | | | | | | | | | | | | | | This changeset attempts to fix a few problems when giving using the high 32bits of a 64bit section offset. There are likely more issues (or perhaps regressions) lurking in the muck here. In general, this moves a few data type declarations to use uplong. Also, add support for 64bit mingw32 building under cygwin. Because native types are used for 64 bit offsets, this won't fix challenges with cross compiling from 32bit -> 64bit. Tested under cygwin, against binary compiled with -Wl,-Ttext=0xffffff8000000000 Signed-off-by: Andrew Mulbrook <andrew262@gmail.com>
* Fix linkage of named file in loader script.Thomas Preud'homme2012-01-041-44/+9
| | | | | | Remove the previous logic to link a named file with a loader script by using tcc_add_dll instead. Hence, all files can be linked, not only files ending in .so/.def.
* Fix problem with PLT and GOT relocs on armel.Daniel Glöckner2011-08-121-3/+12
| | | | | | | | | | | | | TinyCC fails to link correctly to libraries when both R_ARM_PLT32 and R_ARM_GOT32 relocation to a same symbol exist (see http://lists.nongnu.org/archive/html/tinycc-devel/2010-05/msg00032.html for more details). The patch marks all undefined weak symbols found in external libraries as strong. The value of all remaining weak symbols is set to zero just before the section is output. Note by Thomas Preud'homme: it's been 2 months in Debian without any new bug report, hence commiting.
* rename error/warning -> tcc_(error/warning)grischka2011-08-111-24/+24
|
* libtcc: minor adjustmentsgrischka2011-08-111-13/+1
| | | | | | | | | | | | | | | | | - use {B} to substitute tcc_lih_path (instead of \b) - expand CONFIG_TCC_CRTPREFIX in CONFIG_TCC_LIBPATHS which fixes duplicate CONFIG_SYSROOT. - put default CONFIG_SYSROOT ("") into tcc.h - remove hack from commit db6fcce78f4d8ea25036dd6643e9fa83d8e52e5a because $(tccdir)/include is already in sysincludes - configure: error out for unrecognized options. - win32/build-tcc.bat: put libtcc into base dir where it will find lib/include automatically, and build libtcc_test example.
* libtcc: support more than one crtprefixgrischka2011-08-061-1/+1
| | | | Looks like gcc has that. Oh Deer!
* configure: add switches to set search pathsgrischka2011-08-061-36/+16
| | | | | | | | | | | | | | | | | | | --sysincludepaths=.. specify system include paths, colon separated" Sets CONFIG_TCC_SYSINCLUDEPATHS --libpaths=... specify system library paths, colon separated" Sets CONFIG_TCC_LIBPATHS --crtprefix=... specify location of crt?.o" Sets CONFIG_TCC_CRTPREFIX --elfinterp=... specify elf interpreter" Sets CONFIG_TCC_ELFINTERP Also the CONFIG_TCC_XXX were renamed to make them look more consistent. Also move the elf_interp definitions to tcc.h.
* Revert "Add a --multiarch-triplet switch to configure"Thomas Preud'homme2011-08-031-8/+2
| | | | This reverts commit 76adc5770f4ab5b1aaa2e5dde6104efc06431fe2.
* Add a --multiarch-triplet switch to configureThomas Preud'homme2011-08-021-2/+8
| | | | | | | | | | | | | Add a --multiarch-triplet switch to configure. The switch will allow files to be search for each default path in path/<triplet> and then path. Default paths handled that way: - CONFIG_TCC_SYSINCLUDE_PATHS - CONFIG_TCC_LIBPATH - path to crt*.o - path to libgcc_s.so.1 Path missing: elf interpreter path (will be handled in another commit)
* Set CONFIG_TCC_CRT_PREFIX relative to CONFIG_SYSROOTThomas Preud'homme2011-08-011-1/+1
| | | | | Set CONFIG_TCC_CRT_PREFIX relative to CONFIG_SYSROOT for consistency with CONFIG_TCC_LDDIR.
* Accept colon separated paths with -L and -Igrischka2011-08-011-10/+3
| | | | | | | | | | | | | | | | | | This allows passing colon separated paths to tcc_add_library_path tcc_add_sysinclude_path tcc_add_include_path Also there are new configure variables CONFIG_TCC_LIBPATH CONFIG_TCC_SYSINCLUDE_PATHS which define the lib/sysinclude paths all in one and can be overridden from configure/make For TCC_TARGET_PE semicolons (;) are used as separators Also, \b in the path string is replaced by s->tcc_lib_path (CONFIG_TCCDIR rsp. -B option)
* tccpe: cleanup ELFW() macros etc.grischka2011-07-141-16/+1
|
* Use CONFIG_TCC_LDDIR for ld.so on all linux archsThomas Preud'homme2011-07-081-4/+4
|
* Remove unused variablesThomas Preud'homme2011-05-161-3/+6
| | | | | Remove unused local variables and declare them conditionally when they are used only on some architectures.
* Improve weak aliases handlingThomas Preud'homme2011-05-161-17/+19
| | | | | | * Include only the STB_GLOBAL alias symbol in .dynsym section * Stop the loop when STB_GLOBAL symbol is found * Reword / simplify comment
* tccelf: allow multiply defined weak symbolsJoe Soroka2011-03-071-0/+2
|