gcc

Using c99 in C++'s `extern "C"` blocks

I would like to have a function written in C, but callable from C++ which takes a restricted pointer. This is only available in c99, so g++ doesn't like it, even in extern "C" blocks. How can I get around this limitation? ...

Why uninitialized global variable is weak symbol?

It seems uninitialized global variable is treated as weak symbol in Gcc. What is the reason behind this? ...

How to build old source code with latest GCC?

I am trying to build the OSKit source code. It is orginally written against gcc 2.95.2, but on my box I got gcc 4.3.2. And 4.3.2 doesn't allow the following syntax: asm volatile(" pushfl popl %0" : "=r" (eflags)); return eflags; 4.3.2 always complains that: error: missing terminating " character There're so many syntax like t...

How to compile an old version of gcc, say 2.95.2?

My ubuntu installed with gcc 4.3.2. But I need gcc 2.95.2 to compile some of my code. I have downloaded the source of 2.95.2. But when I tried to compile it with 4.3.2, i failed. How could I get the 2.95.2 compiled? Many thanks... Update Please take a look at this thread: http://stackoverflow.com/questions/3693632/how-to-build-old-sou...

Bit popcount for large buffer, assembly preferred

I'm looking for the fastest way to popcount on large buffer of 512 or more bytes. I can guarantee any required alignment, and the buffer size is always a power of 2. The buffer corresponds to block allocations, so typically the bits are either all set, none set, or mostly set favoring the "left" of the buffer, with occasional holes. Som...

What is the deal with undefined symbols in a shared library or dylib?

I have a Makefile for linux that I am porting over to Darwin. The makefile takes a bunch of .o files and links them together into a .so shared object. Okay, so I figured (am I wrong about this?) that the best analog for this in Darwin is the dylib. So I changed the -shared flag to -dynamiclib. Now the code that I am linking together ...

D_FORTIFY_SOURCE and gcc

it's function for generate md5hash: out = malloc(32+1); void md5sum( u_char *secret_data, int secret_len, char *in,char *out ) { ngx_md5_t md5; u_char hash[16]; ngx_md5_init( ngx_md5_update( ngx_md5_update( ngx_md5_final(hash, int ii; for (ii = 0; ii 16; ii++) { ...

gcc, 64 bit, oracle, solaris

info@s490up # gcc -std=gnu99 -o bla -g -O2 -DSunOS=1 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES= -I/usr/include/libxml2 -I/u/app/oracle/product/11.2/rdbms/demo -I/u/app/oracle/product/11.2/rdbms/public -I/u/app/oracle/product/11.2/rdbms/demo -I/u/app/oracle/product/11.2/rdbms/public blabla.c -lclntsh -lrt -lresolv -lnsl -lsocket -lm -lpthread...

How to know if make is using gcc or g++

If I run make then how can I tell if gcc or g++ is being used? I tried to look at the Makefile but didn't find anything. Here is the output from make. I can't figure it out from this either. cd threads; make depend make[1]: Entering directory `/home/anthony/nachos-4.0/code/threads' g++ -I../lib -I../threads -I../machine -DTHREADS -Dx86...

How to use an older version of gcc in Linux

In Linux I am trying to compile something that uses the -fwritable-strings option. Apparently this is a gcc option that doesn't work in newer version of gcc. I installed gcc-3.4 on my system, but I think the newer version is still being used because I'm still get the error that says it can't recognize the command line option -fwritable-s...

gcc compiled code on visual studio

Hi, Assume I have source code for a lib/tool that works on gcc compiler. Can I use the same code and compile it in visual studio. will that be possible at all? If it is possible, how do I do it? ...

XCode can't find GCC

After i updated iPhone SDK to 4.1 I can no longer compile neither for Simulator or Device. I get the following message: error: can't exec '/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2' (No such file or directory) Solution for this? ...

Defining Bytes in GCC Inline Assembly in Dev-C++(.ascii in AT&T syntax on Windows)

Hey guys, The code below is just showing a Message Box on the screen. The addresses are hardcoded to facilitate: int main () { asm("xorl %eax, %eax \n" "xorl %ebx, %ebx \n" "xorl %ecx, %ecx \n" "xorl %edx, %edx \n" "pushl %ecx \n" //$0x0 "pushl $0x20206...

gcov: producing .gcda output from shared library?

Is it possible to produce gcov data files (.gcda files) by running an executable linked to a shared library built with the --coverage option? Basically, I have the main library consisting of multiple c++ files compiled into one shared library and then a subdirectory called "test" containing a test program that links to and tests the mai...

Execute 32 bit object file on 64 bit environment

Hi, I made a cross compiling toolchain for arm-gcc, configuring binutils, newlib, gcc and gdb for the arm-elf target. The problem I am having is, when I compile a program with arm-elf-gcc on my Mac, it generates a 32 bit executable with cannot be executed in the 64 bit environment. What is the easiest way to circumvent this? I could p...

how to generate control flow graphs for C code

any libs readily available with gcc compiler? ...

gdb takes too long and Ctrl-C has no effect

Hey, I have major issue with GNU gdb (GDB) SUSE (6.8.50.20090302-1.5.18). It takes ages to print the value of a nested symbol and hitting Ctrl-C has no effect. Do you know the reason? Is there any workaround? Thanks ...

How to allocate more memory to your program( GCC)

Hi, I want to allocate more memory to program.l What is the gcc flag that allows you to do so? FYI what I am trying to do is create a very large matrix( really large) which is gonna go through compression algorithms later. So there is no way I can avoid creating such a large matrix to store data. ...

g++ version compatibility

This is a specific gcc related question. I have a library compiled with g++ 4.1.2 that I want to give the user. The user can use our API in their code and link our library to create the final executable. The question I have is related to g++ version compatibility. Some of our users are using g++ 4.4.3, others 4.3.3, and still others 4.2...

Why does backtrace not contain Objective-C symbols regardless of -rdynamic?

Update: I'm working with the GNU-runtime on Linux. The problem does not occur on MacOS with the Apple-runtime. Update 2: I compiled the GNU-runtime on MacOS and build the example with it. The error does not occur on MacOS with the GNU-runtime. I would say the problem is the glibc (since backtrace and backtrace_symbols are glibc extensio...