just as you understand.alexfru wrote:In my understanding the problem is that there's a lot of stuff modern compilers put into executables and one needs to either understand all of it and properly handle it or find a sure way to simplify things to a manageable level. This is exacerbated by the fact that things keep changing (optimizations, options, sections change) and old recipes and shortcuts may stop working any time you pick up a newer version of the compiler (everybody seems to like new toys!).ndke wrote:Why do you want to discard the other sections in the first place? What problem are you trying to solve or what are you trying to accomplish?
A dumber and a more stable compiler might actually be an easier option for someone making their first steps in OS development and learning the target architecture. I have a C compiler like that (Smaller C). It is very permissive (because it's not optimizing and not blowing your little bugs out of proportion), it produces simple executables (flat, a.out, PE, ELF, DOS .EXEs), but it has certain limitations and may not be great for everyone or everything (there are limitations in: the language, diagnostic messages, debugging support, did I mention lack of optimization?). But you can do something with it that you can't do with other modern compilers. You can compile C code for 16-bit real or virtual 8086 mode with it (multi-segmented with code/data larger than 64KB (Open Watcom might be the only alternative here but it's got its own problems)). And it supports unreal mode too, great for legacy (that is, non-UEFI) boot loaders.
in osdev, we should pay attention to all the sections generated by gcc, for example, if I got `eh_frame` section, I should search the Internet and then find I can just simply discard it or turn it of by gcc option.
But what about tomorrow, if I get `fh_frame`, `gh_frame`, `dh_frame`, which can be discard, which can need to disable by `gcc -fno-foo-bar` option? even worse, I compile my old source with new version of gcc and it generate a section `.sext`(something like `.text` and needed by .text) and just discard it becouse by `objcopy` I do not copy it at all, I will get a crash