aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
Commit message (Collapse)AuthorAgeFilesLines
* win64: try to fix linkagegrischka2014-05-081-14/+16
| | | | | | | | | - revert to R_X86_64_PC32 for near calls on PE - revert to s1->section_align set to zero by default Untested. Compared to release_0_9_26 the pe-image looks back to normal. There are some differences in dissassembly (r10/r11 usage) but maybe that's ok.
* Return to: e20c1eb99e1003c1e59522c136dbb15c52d7cc7cjiang2014-05-041-6/+6
| | | | | | | | | | | | | | | | | | | | | | | 1: The new patch for the other machines still have the problem. 2: libcrt Rename (what if gcc had libcrt as well) 3: parse_number exact problem 4: VT_VLS is to allow tcc Compile the following int b = 9; struct st { int a; int b [b] }; struct st st1; st1.b [8] = 9; printf ("% d \ n", st1.b [8]); tcc a problem. Due to problems in front, and now can not be improved 5: they commit much, bug difficult to lock, you can not let other people help develop. 6: ('\ t') too Thanks to Michael and Ray Their criticism I have benefited!
* update for x86_64-gen.cjiang2014-05-011-2/+2
|
* rename libtcc1.cjiang2014-04-301-4/+4
|
* x86_64: Handle PLT relocs to hidden symbolsMichael Matz2014-04-141-2/+9
| | | | | For calls to hidden symbols we don't need a PLT slot, rewrite the reloc into PC32.
* ELF: Remove traces of old RUNTIME_PLTGOT codeMichael Matz2014-04-061-63/+1
| | | | | The last users of it went away, no use in keeping this code.
* arm: Use proper PLT/GOT for -run.Michael Matz2014-04-061-9/+53
| | | | | | | | | | | Same as with x86_64, disable the runtime_plt_and_got hack for -run on arm as well. For that we need to handle several relocations as (potentially) generating PLT slots as well. Tested with mpfr-3.1.2 and gawk (both using --disable-shared), there are two resp. five pre-existing problems, so no regressions. This also works toward enabling real shared libs for arm, but it's not there yet.
* x86_64: Create proper PLT and GOT also for -runMichael Matz2014-04-061-16/+21
| | | | | | This makes us use the normal PLT/GOT codepaths also for -run, which formerly used an on-the-side blob for the jump tables. For x86_64 only for now, arm coming up.
* arm: Handle R_ARM_NONE relocsMichael Matz2014-04-041-0/+4
| | | | | | | These relocations are used to express a dependency on a certain symbol (e.g. for EABIs exception handling to the __aeabi_unwind_cpp_pr{0,1,2} routines). Just ignore them in reloc processing.
* run: Always create .got relocsMichael Matz2014-04-041-0/+7
| | | | | | | When output is memory we applied the correct GOT offset for certain relocations (e.g. _GOT32), but we forgot to actually fill the got entries with the final symbol values, so unconditionally create relocs against .got as well.
* ELF: Make first PT_LOAD cover headersMichael Matz2014-04-031-5/+10
| | | | | | | | This makes it so that the first PT_LOAD segment covers ELF and program header and .interp (contained in the same page anyway, right before the start of the first loaded section). binutils strip creates invalid output otherwise (which strictly is a binutils bug, but let's be nice anyway).
* x86-64: shared libs improvementMichael Matz2014-03-311-25/+45
| | | | | | | | | | This correctly resolves local references to global functions from shared libs to their PLT slot (instead of directly to the target symbol), so that interposition works. This is still not 100% conforming (executables don't export symbols that are also defined in linked shared libs, as they must), but normal shared lib situations work.
* x86-64: Add basic shared lib supportMichael Matz2014-03-311-36/+40
| | | | Initial support for shared libraries on x86-64.
* Fix again GOT32 + PLT32 reloc commitThomas Preud'homme2014-03-291-4/+3
| | | | | Fix commit aa561d70119accb59a17f10f9ba69076fb0ab516 by setting has_plt_entry once the plt has been created, not before.
* The hack to allow valgrind works with tcc compiled programsmingodad2014-03-281-1/+5
| | | | | | have the undesired side effect of programs compiled with debug info segfaulting after debug info been striped more tought must be done here
* This allow valgrind to work on linux, some how the PHDR is missing and then ↵mingodad2014-03-281-1/+1
| | | | | | valgrind complain with: Inconsistency detected by ld.so: rtld.c: 1284: dl_main: Assertion `_rtld_local._dl_rtld_map.l_libname' failed!
* Simplify and fix GOT32 + PLT32 reloc commitThomas Preud'homme2014-03-261-3/+2
| | | | | | | | Introduce a new attribute to check the existence of a PLT entry for a given symbol has the presence of an entry for that symbol in the dynsym section is not proof that a PLT entry exists. This fixes commit dc8ea93b13faefb565fb937f8b8c08c40c063549.
* A possible fix for the memory leak reported by valgrind when running ↵mingodad2014-03-251-0/+1
| | | | tcctest.c with tcc.
* Support GOT32 and PLT32 reloc for same symbolThomas Preud'homme2014-03-251-11/+31
| | | | | | | Some symbol (such as __gmon_start__ but this one does not matter to tcc) can have both a R_386_GOT32 and R_386_PLT32 relocation. It is thus not enough to test if a GOT reloc was already done when deciding whether to return early from put_got_entry.
* Always link libtcc1.a in (useful for va_* on x86)Thomas Preud'homme2014-03-251-2/+3
| | | | On x86 tcc call to function in libtcc1.a to implement va_* functions.
* Fix relocation of __bound_initThomas Preud'homme2014-03-171-2/+8
| | | | | | | When bound check is enabled, tcc tries to relocate a call to __bound_init in _init. This means that relocation (in tcc_add_bcheck) must be done after libtcc1.a (which countains __bound_init) is loaded but before crtn.o is loaded as this finalize _init.
* 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.