Commit Graph

182 Commits (078ba241d9c24b15f734b4959f877519d7098140)

Author SHA1 Message Date
Thomas Preud'homme 078ba241d9 Always link libtcc1.a in (useful for va_* on x86)
On x86 tcc call to function in libtcc1.a to implement va_* functions.
2014-03-25 21:18:57 +08:00
Iavael fad8e13ccd Ordinary and implicit rules cannot be mixed in the same string in Makefile 2014-01-23 21:40:08 +04:00
grischka 32a4962593 tcctest: add back testXb (self compile with -b)
- Thanks to Kirill "tcc -b itself" should work now
  (was removed in d5f4df09ff)

Also:

- tests/Makefile:
  - fix spurious --I from 767410b875
  - lookup boundtest.c via VPATH (for out-of-tree build)
  - test[123]b?: fail on diff error
  - Windows: test3 now works (from e31579b076)
  - abitest: a libtcc.a made by gcc is not usable for tcc
    on WIndows - using source instead (libtcc.c)

- tccpe:
  - avoid gcc warning (x86_64)
2014-01-21 13:25:14 +01:00
Thomas Preud'homme 767410b875 Various Makefile fixes for cross-compilation
- Build libtcc1 for cross-compiler on arm (arm to X cross compilers)
- Install libtcc1 and includes for arm to i386 cross compiler
- Add basic check of cross-compilers (compile ex1.c)
2014-01-09 17:15:08 +08:00
Thomas Preud'homme bf2854d2a2 Use GNU triplet prefix for cross tcc compilers
Compatibility symlinks are put in place in case some script were relying
on former names except for CMake since it was added after last release.
2014-01-08 21:07:59 +08:00
Thomas Preud'homme 70a088af87 Explicit that EABI only supports VFP for now 2014-01-07 23:20:31 +08:00
Vincent Lefevre 99851b0d9e fixed permissions for install on Unix
Signed-off-by: Vincent Lefevre <vincent@vinc17.net>
2014-01-07 16:05:31 +01:00
grischka 2bd0daabbe misc. fixes
- tccgen: error out for cast to void, as in
      void foo(void) { return 1; }
  This avoids an assertion failure in x86_64-gen.c, also.
  also fix tests2/03_struct.c accordingly

- Error: "memory full" - be more specific

- Makefiles: remove circular dependencies, lookup tcctest.c from VPATH

- tcc.h: cleanup lib, include, crt and libgcc search paths"
  avoid duplication or trailing slashes with no CONFIG_MULTIARCHDIR
  (as from 9382d6f1a0)

- tcc.h: remove ";{B}" from PE search path
  in ce5e12c2f9 James Lyon wrote:
  "... I'm not sure this is the right way to fix this problem."
  And the answer is: No, please. (copying libtcc1.a for tests instead)

- win32/build_tcc.bat: do not move away a versioned file
2014-01-06 19:56:26 +01:00
Thomas Preud'homme 0382131c6f Provide install-strip target in Makefile 2014-01-04 09:48:45 +08:00
Thomas Preud'homme fbb4841606 Add __clear_cache implementation in libtcc1
Add __clear_cache function for flushing caches to libtcc1.
2013-11-05 19:29:43 +08:00
Thomas Preud'homme d0c4138ac2 Improve texi2html -> makeinfo conversion 2013-05-29 13:16:54 +02:00
James Lyon 1caee8ab3b Sorted out CMake on x86-64 and fixed silly XMM# bug introduced when working on Win64 stdargs.
I removed the XMM6/7 registers from the register list because they are not used
on Win64 however they are necessary for parameter passing on x86-64. I have now
restored them but not marked them with RC_FLOAT so they will not be used except
for parameter passing.
2013-04-25 22:30:53 +01:00
James Lyon 2bbfaf436f Tests in abitest.c now work on Win32.
I expect that Linux-x86 is probably fine. All other architectures
except ARM are definitely broken since I haven't yet implemented
gfunc_sret for these, although replicating the current behaviour
should be straightforward.
2013-04-18 17:27:34 +01:00
James Lyon e31579b076 Fixed tests on Windows (including out-of-tree problems)
Modified tcctest.c so that it uses 'double' in place of 'long double'
with MinGW since this is what TCC does, and what Visual C++ does. Added
an option -norunsrc to tcc to allow argv[0] to be set independently of
the compiled source when using tcc -run, which allows tests that rely on
the value of argv[0] to work in out-of-tree builds.

Also added Makefile rules to automatically update out-of-tree build
Makefiles when in-tree Makefiles have changed.
2013-04-17 20:32:07 +01:00
James Lyon 1d673cbfd6 Fixed out of tree build problem on Windows.
Some files installed are not generated so need to be copied from the
source tree rather than the build tree.

I also switched texi2html for makeinfo --html since texi2html is
apparently unmaintained.
2013-04-17 17:32:18 +01: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
Urs Janssen bfde339b8c fixed pasto in in 108b2876; background for the additional $CC test is:
GCC_MAJOR may be set even is $CC not realy gcc (but i.e. clang, which (as
of 3.1) requires an addtional CFLAG to accept the non portable (gnuisms all
over the place; try to cimpile tcc with Sun^HOracle, Intel, Pathscale, ...
compiler) code).
2013-02-15 13:04:39 +01:00
Urs Janssen 108b287665 - don't use GCC_MAJOR to see if we're not using gcc as GCC_MAJOR might be set
during configure even with --cc=notgcc as long as gcc is installed.
2013-02-15 00:53:33 +01:00
grischka c4397b2b02 configure: detect ARM variants
Using gnu make's variable variable-names.
2013-02-14 21:15:56 +01:00
grischka 762a43877b configure: pass CONFIG_xxxDIR/PATH options via commandline
- except for CONFIG_SYSROOT and CONFIG_TCCDIR

Strictly neccessary it is only for CONFIG_MULTIARCHDIR
because otherwise if it's in config.h it is impossible to
leave it undefined.

But it is also nicer not to use these definitions for
cross-compilers.

- Also:
lib/Makefile : include ../Makefile for CFLAGS
lib/libtcc1.c : fix an issue compiling tcc with tcc on x64
2013-02-14 17:43:24 +01:00
Urs Janssen 062efe6ab8 - make clang accept unportable code in libtcc1.c
- add -dumpversion cmd.line opt
2013-02-14 08:24:51 +01:00
grischka 944627c479 configure: cleanup
- add quotes: eval opt=\"$opt\"
- use $source_path/conftest.c for OOT build
- add fn_makelink() for OOT build
- do not check lddir etc. on Windows/MSYS
- formatting

config-print.c
- rename to conftest.c (for consistency)
- change option e to b
- change output from that from "yes" to "no"
- remove inttypes.h dependency
- simpify version output

Makefile:
- improve GCC warning flag checks

tcc.h:
- add back default CONFIG_LDDIR
- add default CONFIG_TCCDIR also (just for fun)

tccpp.c:
- fix Christian's last warning
  tccpp.c: In function ‘macro_subst’:
  tccpp.c:2803:12: warning: ‘*((void *)&cval+4)’ is used uninitialized
     in this function [-Wuninitialized]
  That the change fixes the warning doesn't make sense but anyway.

libtcc.c:
- tcc_error/warning: print correct source filename/line for
  token :paste: (also inline :asm:)

lddir and multiarch logic still needs fixing.
2013-02-14 06:53:07 +01:00
Thomas Preud'homme f6cfaa6d25 Improve multiarch detection
* Detect multiarch at configure time
* Detect based on the place where crti.o is
* Define multiarch triplet in tcc.h
2013-02-13 17:03:30 +01:00
grischka d6d7686b60 tcc.h: declare CValue.tab[LDOUBLE_SIZE/4]
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.
2013-02-08 19:07:11 +01:00
grischka 7a477d70ca lib/Makefile: use CC, add bcheck to libtcc1.a
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)
2013-02-06 19:01:07 +01:00
grischka d5f4df09ff tests: cleanup
tests:
- add "hello" to test first basic compilation to file/memory
- add "more" test (tests2 suite)
- remove some tests

tests2:
- move into tests dir
- Convert some files from DOS to unix LF
- remove 2>&1 redirection

win32:
- tccrun.c: modify exception filter to exit correctly (needed for btest)
- tcctest.c: exclude weak_test() (feature does not exist on win32)
2013-02-05 14:27:38 +01:00
Thomas Preud'homme 60e647f856 Slightly improved support for !gcc compilers
Hack before a complete solution after 0.9.26's release to be able to
compile tcc with clang.
2013-02-04 18:14:06 +01:00
grischka 97c279f5ea Makefile: fix "allow CONFIG_LDDIR=lib64 configuration"
I forgot the commas.
2013-02-04 17:10:47 +01:00
grischka 3186455599 Makefile: allow CONFIG_LDDIR=lib64 configuration 2013-02-04 16:24:58 +01:00
Thomas Preud'homme 1b1e7ee1fd Fix cross-compilation out-of-tree build
Add tcc.c as a prerequesite of the %-tcc$(EXESUF) target and compile $<
instead of tcc.c to make sure tcc.c is search in directories specified
by VPATH.
2013-01-30 19:39:29 +01:00
grischka 17cf0dcf70 configure: use relative paths for in-tree build
Also
- move CPPFLAGS to Makefile
- Use top_srcdir in lib/Makefile
2013-01-30 18:39:09 +01:00
Thomas Preud'homme 52947e5844 Favor arm hardfloat over arm softfloat.
Favor ARM hardfloat over ARM softfloat calling convention. In
particular, this solve the problem of the raspbian distribution where
the softfloat ld.so pathname (lib/ld-linux.so.3) is actually a symlink
to the hardfloat ld.so pathname (/lib/arm-linux-gnueabihf/ld-2.13.so).
2013-01-29 18:15:23 +01:00
Thomas Preud'homme a4e630c7d9 Install libtcc.h when invoking make install
This fix commit e79281f58e
2013-01-14 18:16:17 +01:00
Thomas Preud'homme 8c56b0cf90 Revert "Added what I call virtual io to tinycc this way we can make a monolitic executable or library that contains all needed to compile programs, truly tinycc portable."
This reverts commit 59e18aee0e.
tcc is being stabilized now in order to do a new release soon.
Therefore, such a change is not appropriate now.
2013-01-14 17:34:07 +01:00
Thomas Preud'homme 5e7954b408 Stop setting -Wno-unused-result switch in Makefile
This commit revert commit 061b5799cc and
subsequent commits to detect whether -Wno-unused-result is supported or
not by the compiler used to compile tcc. No warning about unused results
is issued in a normal build and thus this switch is only needed if
calling make with extra switches in CFLAGS or CPPFLAGS. It should thus
be added with the extra switches when calling make and not in the
Makefile.
2013-01-13 23:38:33 +01:00
mingodad 59e18aee0e Added what I call virtual io to tinycc this way we can make a monolitic 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.
2013-01-11 00:04:38 +00:00
Thomas Preud'homme eb028a8f42 Honor CC when testing for -Wno-unused-result
The compiler used for compiling tcc is the one referenced in the
CC variable. As such, the check for -Wno-unused-result presence should
be done on CC.
2013-01-06 12:22:56 +01:00
Akim Demaille e79281f58e build: fix out-of-tree install
Makefile (install): Fix installation of headers.
Do not try to install twice libtcc.h, once should be enough.
2012-12-21 14:23:28 +01:00
Akim Demaille 7667a8887a build: fix out-of-tree build
* Makefile (TCC-VERSION): Use top_srcdir.
2012-12-21 14:17:23 +01:00
Akim Demaille 8adfb4a419 build: simplify the makefiles
* Makefile: use "else if" to improve readability.
2012-12-21 14:17:16 +01:00
grischka 5ebc6a964d Makefile: revamp "tar" target
- Creates release tarball from *current* git branch
- Includes tcc-doc.html
- converts important windows files files to CRLF
  (requirement for the cmd.exe batch processor, convenience for
   reading the txt in notepad)
2012-12-20 21:29:57 +01:00
Akim Demaille 3f09b90d21 build: fix VPATH builds
* configure (fn_dirname): New.
Use it to ensure the creation of proper symlinks to Makefiles.
(config.mak): Define top_builddir and top_srcdir.
(CPPFLAGS): Be sure to find the headers.
* Makefile, lib/Makefile, tests/Makefile, tests2/Makefile: Adjust
to set VPATH properly.
Fix confusion between top_builddir and top_srcdir.
2012-12-18 10:06:20 +01:00
Thomas Preud'homme 15a315f4a5 Define TCC_ARM_EABI if using hardfloat ABI
TCC_ARM_EABI should be defined when compiling with hardfloat calling
convention. This commit rework the Makefile to distinguish between
calling convention and multiarch and define TCC_ARM_EABI when hardfloat
calling convention is used. The result is to first guess the calling
convention and then add the multiarch triplet if necessary.
2012-11-20 11:36:13 +01:00
Milutin Jovanović e79c3533ec -Wno-unused-result now added only on gcc >= 4.4
This option does not exist in gcc 4.3 and earlier, and it breaks the build on
systems with older compilers. The makefile has been enhanced to test for the
version and adds it only if a newer compiler is detected.
2012-11-14 17:45:15 -05:00
Thomas Preud'homme 061b5799cc Allow source fortification
Source fortification now works correctly : it compiles without warning
except unused result and the resulting tcc is working fine. Hence let's
stop disabling source fortification and hide unused result instead.
2012-11-07 21:15:07 +01:00
Thomas Preud'homme a7f010ee8a Honour *FLAGS everywhere
Add CPPFLAGS, CFLAGS and LDFLAGS everywhere it's missing.
2012-11-06 15:20:53 +01:00
Thomas Preud'homme 034dce4f04 Enable arm hardfloat calling convention
Use arm hardfloat calling convention when the system is using it
(detected by searching for hardfloat multiarch directory).
2012-10-28 19:55:23 +01:00
Thomas Preud'homme c9a2fbaad1 Add multiarch directory for arm hardfloat variant
Arm hardfloat variant uses a different ABI than arm and uses thus a
different multiarch directory for headers and libraries. This commit
detect whether the system uses the hardfloat variant and configure the
multiarch directory accordingly.
2012-07-29 23:46:45 +08:00
Milutin Jovanović 42c1b6ba38 tests: Added numerous tests.
The tests are taken almost verbatim from the open source project PicoC. It can
be found at https://code.google.com/p/picoc/.

The tests range from very simple/trivial ones to more complicated. My view is
that the more tests the better. Without tests like this I was very reluctant to
make any changes to tcc for the fear of breaking things.

The tests pass on Win32, OSX, Linux x86 and x86_64. One or two tests fail on
each platform due to differences in the runtime library.
2012-06-18 15:11:39 -04:00
Thomas Preud'homme b0ebcfa7ba Detect multiarch on Kfreebsd and Hurd 2012-06-13 18:28:24 +02:00