When using gcc compiler (as opposed to llvm) to build 32 bit tcc, compiler flags -mpreferred-stack-boundary=2, -march=i386 and -falign-functions=2 were being used. -march is redundant as -m32 is already being used. The other two seem to be corrupting stack. I am not sure why this is the case, as the explanation of the flags states that only running code size should be affected, but it does. I think that is is safe to remove these flags altogether for all compilers and platforms, especially since they are not being used for 64 bit builds. However I do not want to apply such wide change without agreement from the people on the mailing list.
Unified · Split
| @@ -42,6 +42,7 @@ tags · 41 unmodified lines | ||
| 42 | 42 | .DS_Store |
| 43 | 43 | *.swp |
| 44 | 44 | lib/x86_64 |
| 45 | +lib/i386 | |
| 45 | 46 | tcc-doc.info |
| 46 | 47 | conftest* |
| 47 | 48 | tiny_libmaker |
| @@ -15,6 +15,7 @@ CFLAGS+=-Wno-pointer-sign -Wno-sign-compare -D_FORTIFY_SOURCE=0 · 14 unmodified lines | ||
| 15 | 15 | endif |
| 16 | 16 | endif |
| 17 | 17 | |
| 18 | +ifneq ($(TARGETOS),Darwin) | |
| 18 | 19 | ifeq ($(ARCH),i386) |
| 19 | 20 | CFLAGS+=-mpreferred-stack-boundary=2 |
| 20 | 21 | ifeq ($(GCC_MAJOR),2) |
| @@ -23,6 +24,7 @@ else · 2 unmodified lines | ||
| 23 | 24 | CFLAGS+=-march=i386 -falign-functions=0 |
| 24 | 25 | endif |
| 25 | 26 | endif |
| 27 | +endif | |
| 26 | 28 | |
| 27 | 29 | ifdef CONFIG_WIN64 |
| 28 | 30 | CONFIG_WIN32=yes |