On Mon, May 20, 2019 at 3:09 PM Ben Hutchinson <[email protected]> wrote:
> Date: Sun, 19 May 2019 01:11:26 +0200 >> From: Daniel Gl?ckner <[email protected]> >> >> If you don't need __chkstk, you are not compiling for Windows and should >> not use a TinyCC that is targetting Windows. TinyCC targetting Linux does >> not emit calls to __chkstk. >> >> >> > Not quite true. Assembly language is my starting point for learning > low-level x86 programming. I have used NASM and FASM to compile windows > programs from assembly code. Neither of these assemblers output any calls > to stack check functions in addition to your actual program code. I've > never had any problem with programs I've written in assembly regarding the > stack. The nice thing about assembly is it only outputs what you tell it > to. It doesn't add any calls to other functions that you didn't explicitly > tell it to. However, due to the extremely low-level nature of programming > in assembly, it takes a lot of code to do simple tasks. > > This is why I want to upgrade to C to do my low-level programming. Making > loops and other useful code structures is very easy in C, compared to > assembly. However the problem with C is that depending on the compiler you > use, it can insert additional code (usually in the form of various checks) > into your program that you didn't explicitly tell it to. > > Therefore, I have been on a quest, looking for a C compiler which does NOT > generate code that you didn't explicitly tell it to. I thought I had found > what I was looking for, when I discovered TinyCC. To get it to perform as > expected, I always use the command line switch -nostdlib and also use the > entry point "_start" rather than using "main" function that most C > programmers use. This forces it to not insert additional initialization > functions in my program, and instead start by executing the code I tell it > to. This for the most part causes TinyCC to ONLY do what I tell it to. > > But there is ONE POINT TinyCC fails on. This is its insertion of the > __chkstk function. At first I thought since TinyCC was so small that it was > too small to have any code to generate unnececary code. But that is clearly > not the case. It seems it easily is capable of defying the programmer's > wishes. Even worse, as of me writing this, there is no command-line switch > that disables TinyCC's generation of __chkstk. That makes TinyCC a bad C > compiler. > > For me, a good C compiler is one that: > 1) Uses all of the official C syntax (not a language that is an > alternative to C) > 2) Generates machine code in response to the C code that I supply in the > source code > 3) Does not generate machine code that I do not instruct it to > 4) If by default it generates extra code, then it has a command line > switch to disable this > > TinyCC is good for the first 2 of these points. However, it fails on the > last 2 of these points. That right there means it is a no-go for me. Unless > of course the officials who are programming TinyCC wish to fix point-4, and > actually provide a command line switch that allows you to force TinyCC to > ONLY output explicitly what you tell it to (which means no stuff like calls > to __chkstk gets inserted into the code). > > Keep in mind I'm not asking the devs to completely remove from TinyCC the > generation of code that calls __chkstk. I'm just asking them to add a > command-line switch that would allow somebody to start TinyCC in a mode > where it didn't add these checks to the code. > > If the official TinyCC developers were to make this one simple change, > TinyCC would no longer be a no-go for me, and in fact TinyCC would then > become my primary means to write Windows software. > If you're skilled in C, why not submit a patch yourself rather than demand others do so? -- -Austin GPG: 267B CC1F 053F 0749 (expires 2021/02/18)
_______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
