Covert gcc arguments to CMake file
So I am trying to learn CMake and I want to convert the followinggcc "-DARCH=\"`uname -a`\"" cli_arch.c arch.c to a CMakeLists.txt file. This is what I got so far: Running cmake...
View ArticleApple clang -O1 not optimizing enough?
I have this code in C:int main(void){ int a = 1 + 2; return 0;}When I objdump -x86-asm-syntax=intel -d a.out which is compiled with -O0 flag with GCC 9.3.0_1, I get:0000000100000f9e _main:100000f9e: 55...
View ArticleGet a label address out of the function scope in gcc/clang (C++)
I'm making some kind of interpreter and I'm computing a static const jump table thanks to local label addresses.You know the drill,static const int JUMP_TABLE[] = { &&case0 - &&case0,...
View Articlehow compile using gcc (MinWG) or clang without standard libraries and...
I want gcc/clang (in windows) to compile only my code without any additional linked libraries so that my main() will be the first thing to be executed. In MSVC i could do that by /MT /GS- /NODEFAULTLIB...
View ArticleGCC build time doesn't benefit much from precompiled headers
I have a huge project, something about 150 000 LOC of C++ code. Build time is something about 15 minutes. This project consists of many sub-projects of different sizes.I have built separate precompiled...
View ArticleC compiler cannot create executables (installing Cocoapods)
While installing RNPermissions and its dependencies I run into an error. Seems to be a problem with my compiler or the package that is being installed.The error: checking whether the C compiler...
View ArticleInitializing enum-indexed array?
gcc has a very nice extension in C that allows you to keep data in arrays using enum as keys: enum keys { key_alpha = 0, key_beta = 1, key_gamma = 2 }; ValType values = { [ key_alpha ] = {...
View ArticleWhat's the difference between "statically linked" and "not a dynamic...
Consider this AMD64 assembly program:.globl _start_start: xorl %edi, %edi movl $60, %eax syscallIf I compile that with gcc -nostdlib and run ldd a.out, I get this: statically linkedIf I instead compile...
View ArticleRunning a Visual Studio program from the command line [closed]
I have downloaded these project files:http://viscomp.ucsd.edu/classes/cse167/wi17/assignments/Windows/mytest-windows.zipThis is supposed to run on Visual Studio. But i want to run it from the command...
View ArticleGCC error with -mcpu32 flag, CPU32 compiler needed
I am patching code into my car's ECU. This has a Motorola MC68376 processor, so I'm using the appropriate CPU32 instruction set.I want to continue to write in assembly code so that I can explicitly...
View ArticleHow to compile Jonesforth on OSX Mojave?
Attempting to compile Jonesforth on OSX throws:jonesforth.S:1154:10: fatal error: 'asm/unistd.h' file not found".So I tried this advice for Linux, but still complains.This Power PC port throws other...
View ArticleHow to do time profiling of a C program in HP-UX?
I want to do a time-based profiling of an application written in C on HP-UX. I want to see which function is taking maximum amount of time, slowing down the operational duration. Is there a way to do...
View ArticleHow does GCC print a stack trace?
when gcc/g++ encounters an ICE (internal compiler error), then recent versions of the compiler will print a neat stack trace before exiting.Questions: What technology is used to implement that? GCC is...
View Articlegcc differences between -O3 vs -Ofast optimizations
I was just reading through the gcc manual to find out the difference between -O3 and -Ofast.For -O3-O3Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the following...
View ArticleDoes it provide any benefits to simultaneously use __attribute__ ((pure)) and...
I am optimizing a c program and I would like to know if it does make any sense to use __attribute__ ((pure)) and static inline both in the same function declaration?
View ArticleForcing gcc to only look in one directory for library files
So I am making a C application and I have all the library files .so , .a etc in a ./lib directory in the same directory as my C application.I am compiling my C application with the -L./lib flag.But it...
View ArticleHaving trouble installing pywrapfst
I need to install pywrapfst, but when I do python setup.py install in the root folder like the github says, I get a lot of warnings and syntax errors, as well as errors of 'too many arguments', and I...
View ArticleHow to compile C++ code using modules-ts and gcc (experimental)?
I've been trying to code something using the new experimental feature "modules-ts" that will be included in c++20. I've cloned the gcc branch (found here: https://gcc.gnu.org/wiki/cxx-modules), and I'm...
View ArticleSuddenly compile errors on Windows [closed]
I am working on a crate but suddenly, compilation fails on 2 of my windows computers. On a macbook the project is compiling fine. I left the project 2 weeks untouched (at that time, it was compiling)...
View ArticleCompile elf with got[0] and got[1] not writeable
I want to compile a elf executable where got[0] and got[1] is only readable but the rest of got should be writable as well, aka partial relro.I have seen it before in ctf challenges where got are...
View Article