I’m in a bit of a pickle. I have some code that until recently ran fine but has now started to fail when optimizations are enabled. This code runs just fine with optimizations disabled -O0 both -O1 and -O2 cause the issue to occur (I don’t use -O3). Unfortunately, I can’t post the source code (it’s rather involved and proprietary)
Tag: gcc
Why does linking with pthread cause a segmentation fault?
I have a stripped down simple program with a static variable (‘abc.cpp’): I compile it and it works: However, if I link in the pthread library…. I know it doesn’t use threading here, but in the actual non-stripped-down program, it links to a library that does use threading. It feels like it should be okay to link to pthread even
Symbols not found during linking
I have a problem with a shared library (Linux) and a program that links against this library but does not find the symbols – although they are there. That’s what I have: A shared library “libetest.so” that is located in /usr/lib. When I do an it gives (beside some others) this output: Now I have an application that makes use
Compiling a program with limited library access
i want to compile a C program with gcc and glibc(or any other c library) but i want to limit the program access to certain functions for example program should not be compiled if it uses sockets or signal handling functions. any idea how i could do this?? by the way i want to use this on a simple programming
How to set GCC_COLORS in gcc4.9 to emit colorizing diagnostics messages?
gcc4.9 supports the colorizing diagnostics for compiler warning/error messages. We can enable it for a particular program using the option “fdiagnostics-color”. Currently I am using gcc4.9.1 and I append this particular option in my makefile as follows: If I compile a *.cpp file a get the following nice coloured message. This is really great feature added by GCC. While reading
free(): invalid pointer; ld terminated with signal 6 [Aborted], core dumped
Error Currently using this to compile my C++ program: I am using Mingw to compile my C++ program from Linux (Ubuntu) to a Windows executable. I am relatively new to compiling via command line, but I would like to switch my work environment completely over to Linux. When I attempt to compile the program, I get the following error: I
Variable reset after scanf
I wrote the below function : I print the currentPlayer on any level to see what’s going on -> here what I get: Why the current player is 0 after scanf? I didn’t touch it. Answer The buffer location has only room for 2 characters and scanf puts an extra NUL character at end. Therefore you have a stack corruption
Why aren’t glibc’s function addresses randomized when ASLR is enabled?
In trying to understand ASLR, I built this simple program: ALSR seems to be enabled: and I used GCC to compile the program: Every time I run this program, it prints the same address (0x400450). I would expect this program to print a different address each time if glibc is loaded at a random address. This is surprising to me,
Does Clang/GCC really support a delay loading feature?
Would you mind to leave your comment on this if you have really experienced which relates to the title above? I have tried to make a shared object to be delay loaded with both Clang and GCC on Ubuntu (I actually don’t mind which compiler is used), but they do not look really support any delay loading feature (I expected