I have the following C application:
#include <stdio.h>
void smash()
{
int i;
char buffer[16];
for(i = 0; i < 17; i++) // <-- exceeds the limit of the buffer
{
buffer[i] = i;
}
}
int main()
{
printf("Starting\n");
smash();
return 0;
}
I cross-compiled using the following version of gcc:
armv5...
Hi,
Is it possible to compile native GCC for ARM (host == target == ARM) using Code Sourcery G++?
If it is not possible, could I use crosstool-NG to build the cross-compile and then using this one for compiling the native ARM GCC?
Thank you,
Edit: as to why: I'm creating my own distro for beagleboard...
...
Working on some linux (Ubuntu) systems, running some in-house C and C++ apps (gcc).
There is a long list of signals which are handled, such as SIGSEGV and SIGINT. On signal, the callstack is obtained using backtrace(3) and backgrace_symbols(3). For C++ the function names are even demangled with abi::__cxa_demangle().
My question is: ...
Given I have a shared lib (“dynamic_one”) which links a specific version of a static lib (say 0.9.8 of openssl). Further I have an app which links another version of this lib (say 1.0.0 of openssl) dynamically and also loads the “dynamic_one” lib.
Actually I encounter strange memory corruptions due to the incompatible ABI of the two ope...
Hi,
I'm wondering can I use static libraries (lib*.a files) compiled with one
version of MingW and use them on the other version ? Or do I have to recompile all libraries ?
...
I have a small project that I need to compile. I have one header and one source that I have created and a nearly empty driver.c that includes my header.
Observe:
// iol.h
#ifndef __IOL_HEADER
#define __IOL_HEADER
/* program: iol.h
date: 5 October 2010
*/
#define UNIX 1
#define WINDOWS 2
#define OS UNIX
#if OS == UNIX
#...
I have inherited an application that links to a library which MAY HAVE been built with gcc3. Or maybe with the imagecraft compiler. That information has now vanished to the heavenly bitfield and I am left with a libXXX.a library against which to link my app. I cannot recompile the libXXX.a because it requires certain unknown headers from...
I am interested in seeing the code where gcc has actually optimized the code. Is there a way I could do?
I have gone through few other similar questoins, I have tried following few things,
-Wa,ahl=filename.lst :- this option is really good, you can browse the code and corresponding machine code, but it is not good when I enable O3 opt...
Following this question: http://stackoverflow.com/questions/3807480/weird-mips-assembler-behavior-with-jump-and-link-instruction I have a working GNU assembly toolchain for my single cycle MIPS project (no branch delay slot!). I would really prefer to write in C though. The code itself generated from the compiler does run, but I have to ...
On 64 bit host I am trying to build shared libraries with -m32 option. Is it possible for these libraries to be linked with regular 64 bit libraries?
I am doing something like this:
g++ -m32 -shared source.cpp -l 64_bit_library.so -o 32_bit_library.so
and getting error messages like this:
/usr/bin/ld: skipping incompatible 64_bit_li...
I know I can do this:
#define MACRO(api, ...) \
bool ret = api(123, ##__VA_ARGS__);
This is just an example, it's part of a more complicated solution. The point is that I need to append the variable number of arguments to the first 123.
The ## makes the compiler strip out the comma after the 123 argument if no arguments were passed ...
I'm using dirname from libgen.h to get the directory path from a filename's path.
This is it's signature:
char * dirname (char *path)
When compiling on a 32 bit machine or using -m32 with gcc, it all works fine.
My code looks like this:
char* path = "/path/to/my/file.txt";
char* path_cpy = strdup(path);
const char* dir = (const cha...
Hello,
I have a question about templates. I would like to have a templated class that contains, say, an array of either float's or double's.
I can write a clone() function that duplicates it. No problem. However, I would like to have another function called cast() that does a translation back and forth between double and float. This ha...
I'm having a problem installing gcc43 on my 10.4.11 OSX
I've tried to install from macports with no luck.
What other options do i have to get it up and running so I can install scipy and numpy?
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.or...
Hi all,
I want to create a ruby extension that uses c. But when I compile it with gcc, I am getting this error:
gcc rubyext.c -orubyext -I /usr/local/include/ruby-1.9.1/
In file included from rubyext.c:1:
/usr/local/include/ruby-1.9.1/ruby/ruby.h:25:25: error: ruby/config.h: No such file or directory
In file included from rubyext.c:1:...
How do I build executables using GCC so that it is not possible to search for a keyword. For example, I wrote my code using a function called "PascalTriangle" and built an executable and distributed. if I grep "PascalTriangle" on the executable then I am able to atleast know that the binary was built using that function. How do I hide th...
I am new to programming, and even newer to Linux. I was told that Linux is the best OS to learning to program as it lets a programmer interface closely with the machine architecture. I heard a lot about the GNU tool-chain and that it provides the best programming environment on Linux so I decided I won't use an IDE and put in as much tim...
Is it possible to check the minor version number of GCC in cmake?
I want to do something like this:
If (GCC_MAJOR >= 4 && GCC_MINOR >= 3)
...
Hi,
When you see code like this in C, what's the order of assignment?
int i = 0, var1, var2;
I don't understand the syntax...
...
Maybe they have a good reason, but I'm struggling to understand why a new OS would still ship with such an old compiler that was originally released in 2007. Did Apple modify it heavily and so therefore it has some features that are required? Is it possible to just download 4.5.1 and use it with XCode?
...