Commit Graph

38 Commits

Author SHA1 Message Date
grischka
ebaa5c81f4 dynamic executables (PIE)
Allows to create dynamic executables, using the code path
for TCC_OUTPUT_DLL but add an .interp header (plus a FLAGS_1
entry in the dynamic section to make 'readelf' say "PIE")

Introduces TCC_OUTPUT_DYN as alias for TCC_OUTPUT_DLL.
There is no runtime option,  only one to configure:

    ./configure --config-pie

100 insertions(+), 76 deletions(-)
2022-07-24 09:44:50 +02:00
Reinhard Urban
9712541156 Add missing ELFOSABI constants
from my github rurban/brandelf
2022-06-13 15:10:15 +02:00
Christian Jullien
db6dd66047 OpenBSD: -arm- Add more R_ARM* constants in elf.h. 2021-01-11 07:21:57 +01:00
Christian Jullien
760024bde9 NetBSD: Trying to fix reloc error 38 on arm - WIP 2021-01-06 07:02:19 +01:00
herman ten brugge
0352c41a07 add R_ARM_GOT_PREL for clang 2020-12-22 14:31:09 +01:00
herman ten brugge
baacb0f52a OpenBSD: runtime fixes
After this commit we can compile and run code with some limitations.
- The dlsym function is broken so this makes -run and bound checking
  not work all the time. Make -k test does work for most code.
- You have to do:
    ln -s /usr/lib/libN.so.x.y /usr/lib/libN.so
  for all .so files in /usr/lib.
  OpenBSD uses opendir/readdir to find the correct so file. This is
  not the way other platforms do this.
  Also the .a versions do not have all symbols that are present in the .so
  files.

tcc.h:
- Use different dynamic loader

elf.h:
- Add SHT_X86_64_UNWIND

tccelf.c:
- Do not use -dl
- Add required NOTE section
- Add extra dynamic tags
- Allow SHT_X86_64_UNWIND/SHT_NOTE in tcc_load_object_file

tccrun.c:
- Uses MAP_FIXED because without the offset between exec and data section
  becomes too big for x86_64

lib/bcheck.c:
- Do not use __libc_freeres

tests/tcctest.c:
- aligned_function also disabled for __GNUC__ == 4
2020-12-07 08:27:10 +01:00
Michael Matz
0676d5bc23 riscv64: Add skeleton target 2019-08-14 18:18:46 +02:00
Larry Doolittle
1b6806e5bb Spelling fixes
Comments only, no change to functionality
2017-09-24 18:03:26 -07:00
Larry Doolittle
19d8b8a173 Spelling fixes in C comments only 2017-05-07 21:38:09 -07:00
Michael Matz
600018ce47 elf: Ignore SHF_COMPRESSED sections
some newer systems have debug sections compressed by default, which
includes those in the crt[1in].o startup files.  These can't simply
be concatenated like all others (which leads to invalid section contents
ultimately making gdb fail) but need special handling.

Instead of that special handling (decompressing, which in turn requires
linking against zlib) let's just ignore such sections, even though that
means to also ignore all other debug sections from that particular input
file.  Our own generated files of course don't have the problem.
2017-05-06 07:30:44 +02:00
Thomas Preud'homme
ee2108d07d Add missing relocation info for C67 target
Fill in relocs_info table for C67 and fix R_C60_NUM value to really be
greater than all relocation values known to TCC.
2016-12-10 17:31:20 +00:00
Thomas Preud'homme
59391d5520 Fix relocs_info declaration in tcc.h
C standard specifies that array should be declared with a non null size
or with * for standard array. Declaration of relocs_info in tcc.h was
not respecting this rule. This commit add a R_NUM macro that maps to the
R_<ARCH>_NUM macros and declare relocs_info using it. This commit also
moves all linker-related macros from <arch>-gen.c files to <arch>-link.c
ones.
2016-12-05 20:51:10 +00:00
grischka
d48662d496 tccgen: scopes levels for local symbols (update 1)
Catch top level redeclarations too.

Also fix mistakes in tcctest.c and the tcc sources (win32)
showing up now.
2016-05-05 20:04:00 +02:00
Thomas Preud'homme
933c2235e5 i386: Add support for new psABI relocation
R_386_GOT32X can occur in object files assembled by new binutils, and in
particular do appear in glibc startup code (crt*.o). This patch is
modeled after the x86_64 one, handling the new relocation in the same
trivial way.
2015-12-27 12:09:45 +08:00
Michael Matz
e264243adc x86-64: Define symbol constant for new relocs
Whoops, we have our own <elf.h> copy, so I can just as well add
the symbol defines for the relocs instead of hard-coding numbers
in tccelf.c.
2015-12-17 07:30:35 +01:00
gus knight
89ad24e7d6 Revert all of my changes to directories & codingstyle. 2015-07-29 16:57:12 -04:00
gus knight
47e06c6d4e Reorganize the source tree.
* Documentation is now in "docs".
 * Source code is now in "src".
 * Misc. fixes here and there so that everything still works.

I think I got everything in this commit, but I only tested this
on Linux (Make) and Windows (CMake), so I might've messed
something up on other platforms...
2015-07-27 16:03:25 -04:00
Edmund Grimley Evans
b14ef0e24b Add arm64 (AArch64) as a target architecture. 2015-02-23 22:51:03 +00:00
Thomas Preud'homme
28f0286479 Update elf.h 2014-01-08 17:38:31 +08:00
Thomas Preud'homme
cf02f920c1 Revert "Add support for thread-local storage variables"
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 1c4afd1350.
2013-11-03 18:55:54 +08:00
Thomas Preud'homme
1c4afd1350 Add support for thread-local storage variables 2013-10-29 22:10:02 +08:00
Urs Janssen
0bdbd49eac add version number to manpage
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)
2013-02-17 00:48:51 +01:00
Thomas Preud'homme
fad68c9163 Add support for R_ARM_THM_{JUMP24,CALL} relocs
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.
2012-10-28 19:55:12 +01:00
Thomas Preud'homme
2fe7fd9e87 Support for R_ARM_[THM_]MOV{W,T}_ABS[_NC} relocs
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.
2012-10-10 00:19:43 +02:00
grischka
adc80009c8 elf.h: define SHF_MERGE etc. 2011-07-14 19:35:20 +02:00
grischka
aa80e5b1ff tccpe: cleanup ELFW() macros etc. 2011-07-14 19:23:04 +02:00
Thomas Preud'homme
bcc9137a10 Add support for indirect functions as externals.
Add link support to use indirect functions defined in external modules
2010-08-09 20:20:09 +02:00
Daniel Glöckner
a867f42597 don't discard SHT_((PRE)INIT|FINI)_ARRAY sections 2010-05-15 01:26:56 +02:00
Daniel Glöckner
128e46f91b ARM: add support for R_ARM_V4BX 2010-05-15 01:23:34 +02:00
Frederic Feret
0d768b9713 added 16-bit x86 assembly support 2009-11-13 18:08:58 +01:00
Shinichiro Hamaji
73a84cefda Imported several macros required by x86-64 2008-12-02 02:25:54 +01:00
Shinichiro Hamaji
7dd792ef51 Introduce ElfW macro and ELFW to encapsulate the difference between Elf32_* and Elf64_*. Also, introduce ElfW_Rel and SHT_RELX for difference between REL and RELA. 2008-12-02 02:25:45 +01:00
grischka
34140dd627 Use _WIN32 for a windows hosted tcc and define it for the PE target. 2007-12-13 19:07:19 +00:00
grischka
f99d3de221 Import 409,410: ARM EABI by Daniel Glckner 2007-12-04 20:38:09 +00:00
bellard
484ee920c1 do not assume signed char (grischka) 2005-04-17 13:15:05 +00:00
bellard
bdd09709d7 ELF visibility defines 2005-04-10 21:43:10 +00:00
bellard
79c72b2419 initial TMS320C67xx support (TK) 2004-10-04 21:57:35 +00:00
bellard
53196cd475 added 2002-12-08 14:36:36 +00:00