gcc

How can I force make to exit if compiling one dependency fails?

I've posted the relevant bits of my makefile. When I run make all on this makefile, there's a compilation error when compiling debugosd.o. However, because make found a previously built debugosd.o, it just continues on to build dialup.otz. Without deleting all the .o's, how can I force debugosd.o to become out-of-date - and so force ma...

Linkage in C: does GCC follow the C99 spec, or do I not understand the spec?

I'm trying to understand the exact behavior of storage class specifiers in C99, and some GCC behavior seems not to follow the spec, unless I misunderstand the spec. From 6.2.2 (2): Within one translation unit, each declaration of an identifier with internal linkage denotes the same object or function. However, I tested GCC (powerp...

gcc code::blocks shared library questions

I'm using code::blocks on a linux system with the gcc compiler, and I want to be able to use the shared library template to make a shared library with classes, then make another project that accesses that shared library(at compile time, not dynamically) and classes. I'm sure that code::blocks has simple way of doing this without making c...

I need a tree dump option, which doesn't exist any more in current gcc versions

Older versions of gcc (for example 4.0.2 or 4.1.2) had the option -df (see http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Debugging-Options.html#index-fdump_002drtl_002dcfg-357). I used this option to dump the files filename.c.134r.life2 and filename.c.126r.life1, because I want to extract some values out of these files (for example the reg...

gcc with parameters "-S -save-temps" puts intermediate files in current directory

The parameters -S -save-temps work fine, as long as i don't use them on files with the same name. Think of the following situation: I have a project with a main directory and a subdirectory with the name subDir and in both of the directories are files placed with the name file.c. If I now call gcc -S -save-temps file.cpp subDir/file.c o...

/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1 error

I am getting the error Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1 every time I try to run the program on the iPhone device and the Simulator. I am also seeing this: ld: duplicate symbol .objc_class_name_MainView in /Volumes/Mark's Flash Drive/iFtB/build/iFtB.build/Debug-i...

What C GNU-isms exist?

I was recently porting a project from GCC to clang(in which I fixed a number of C GNU-isms). This got me thinking: what C GNU-isms(extensions to the C language supported in GCC, which are not standardized) exist? Is there a comprehensive list anywhere? ...

Mac solution for "safe" alternatives to "unsafe" C/C++ Standard Library functions?

What's the best one-stop-shop "safe" C library solution on the Mac? I use quotes on "safe"/"unsafe" because there is much debate as to the benefits of certain Standard Library functions or their putatively improved alternatives. Many traditional Standard C Library functions (e.g., vfprintf) are considered to be unsafe due to the potent...

Why am I getting the message "Single-stepping until exit . . . which has no line number information" in GDB?

I've compiled my C program using gcc 4.4.1 using the flag -g, but when I try to step through one of my functions in gdb version 7.0, I get the message: "Single stepping until exit from function _DictionaryTree_getNodeList, which has no line number information." Can someone tell me why this is happening? ...

ada95 have 3 files .ali, .adb and .o - can I compile

Hi, I've found some old college work, with my final Ada95 project on it. Sadly, the disc was corrupted, and I have only managed to recover 3 files (the source and executable couldnt be recovered): project.adb, project.ali and project.o Are these 3 files enough to compile a new exe? I'm downloading the gnat compiler now, but have to ...

gcc -print-prog-name=??? doesn't work as I would expect

if I understand the gcc manuals right than the option -print-prog-name should print the name of the program used. But it seems that this option only echoes the given argument Examples: gcc -print-prog-name=ld --> ld gcc -print-prog-name=xxxsome-funny-name --> xxxsome-funny-name Is this the expected behaviour? I think it should prin...

Is there a way to add '-lpthread' to default linker flag without change the makefile

HI, I am getting the following linker error on linux: My guess is it is missing '-lpthread' in the linker thread. My question is if there is a way for me to set my environment on linux such that it will add '-lpthread' when it links? /usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/libutils.a(Threads.o): in ...

how to linking with dynamic lib (.so) and static libc.a

Hi I'm trying to link with the static libc.a and a dynamic lib .so unsuccessfully. I've already tryied the following: Firstly I test with all dynamic: gcc -shared libtest.c -o libtest.so gcc -c main.c -o main.o gcc main.o -o test -L. -ltest It's working (compile and execute) Secondly I test what I want (dynamic lib and static lib...

Comprehensive gnu make / gcc tutorial

I've just started learning C++ and I find it very hard to find short, comprehensive tutorials on how to use gnu make / gcc. Any ideas (please don't point me to the official gnu make tutorial, it's way too much in-depth for my purposes ;-)). ...

Xcode and makefile

Hey all, What I want to achieve: I'm porting an application to iPhone and I need to run some scripts on the generated assembly by the compiler (our optimization stuff) and then compile it to an executable. I always used a standard make file and did something like this gcc -S -c my_source.c # compile and generate ASM optimize.sh my_sour...

Patching gcc, Adding memory write to a sparc fsqrts insn

I'd like to patch gcc's sparc machine description so that the destination register of a FPU sqareroot operation fsqrts is stored into memory after each fsqrts. like this: fsqrts %f2,%f4 st %f4, -4[%fp] <= add this after every fsqrts where -4[%fp] is a slot allocated on the stack for each fsqrts insn The s...

how to get the size of a C global array into an assembly program written for the avr architecture compiled with gcc

I have a .c file with the following uint8_t buffer[32] I have a .S file where I want to do the following cpi r29, buffer+sizeof(buffer) The second argument for cpi muste be an immediate value, not a location. But unfortunately sizeof() is a C operator. Both files are compiled to separate object files and linked together afterward...

GCC Extended ASM syntax: load 128-bit memory location as source

Hi all, GCC generates this code for the shuffle() below: movaps xmm0,XMMWORD PTR [rip+0x125] pshufb xmm4,xmm0 Ideally this should be: pshufb xmm4,XMMWORD PTR [rip+0x125] What is the extended ASM syntax to generate this single instruction? Many thanks, Adam PS: The commented out intrinsic generates the optimal code for this examp...

Static function access in other files

Hi, Is there any chance that Static function can be assessed outside the file scope. ? ...

Debugging vtable Linker Errors in GCC

Now and then when using GCC I get cryptic errors like this: undefined reference to 'vtable for classname' When it's not caused by a missing library, this not-very-descriptive error message always causes me to dig through code files line by line to find the missing implementation for a virtual function. Is there a way to make the linke...