GCJ throws error: "Undefined reference to main" when compiling
I´d wanted to compile a simple Java "Hello World" program like it was repesented on the GeeksforGeeks Hello World Tutorial, by using gcj in Linux Ubuntu. This is the source code:class HelloWorld {...
View ArticleWrong calling conventions with float values with MinGW
I am trying to use my assembly functions work with C code and found that MinGw doesn't follow calling conventions for floating-point values, and this differ from versions of mingw.Test file with single...
View ArticleIs there a compiler hint for GCC to force branch prediction to always go a...
For the Intel architectures, is there a way to instruct the GCC compiler to generate code that always forces branch prediction a particular way in my code? Does the Intel hardware even support this?...
View ArticleInterrogate the C compiler about data types when cross-compiling
I am working on a cross-platform project that uses GNU Autotools for the build system, and I was wondering if there is a way to run a simple sizeof(int) and pass the result to the configure script (or...
View ArticleIBM example code, non re-entrant functions doesn't work in my system
I was studying re-entrancy in programming. On this site of IBM (really good one). I have founded a code, copied below. It's the first code that comes rolling down the website.The code tries showing the...
View ArticleNinja doesn't use CC and CXX?
I'm compiling Tesseract with Ninja. Clang has some linking problem, and gcc works. I exports CC and CXX to gcc and make -j8 runs fine. However, Ninja (using the given script in /build folder) still...
View ArticleProper way of deallocation of double pointer to struct
I am trying to add memory deallocations to old C code. I have a hash table of custom objects (HASHREC). After analysis of current code and reading other SO questions, I know that I need to provide...
View ArticleCompile AVD kernel for memory forensics with LiME
Hello this is my first time posting on stackoverflow so please forgive my naivety. I'm currently trying to compile a custom kernel with LKM enabled. The main problem is that all guides and tutorials...
View ArticleGCC pragma optimize param
I am aware that I can enable or disable certain optimizations via function attributes (or globally via a pragma) in GCC using the following syntax:#pragma GCC optimize ("peel-loops") This is equivalent...
View ArticleHow to use options with GCC pragma optimize? (eg. max-peeled-insns)
I am aware that I can enable or disable certain optimizations via function attributes (or globally via a pragma) in GCC using the following syntax:#pragma GCC optimize ("peel-loops") This is equivalent...
View ArticleStripping out static text from log messages and save only variables
I know that there is a way to get rid of static text from log messages and keep only the variables part of the message in memory. But I am not sure exactly how it is done.To give a concrete example to...
View ArticleAdd linux headers in gcc command
So I'm trying to include some headers in a c file on ubuntu16.04.#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/stat.h> #include <sys/mman.h>...
View ArticleIs there a 128 bit integer in gcc?
I want a 128 bit integer because I want to store results of multiplication of two 64 bit numbers. Is there any such thing in gcc 4.4 and above?
View ArticleAnonymous functions return dynamically allocated values
The question is based on a design pattern solution easily doable in other languages but difficult to implement in C. The narrowed down code is below.Building on this answer, I'm trying to find a...
View ArticleHow to print to console in Linux from RISC V assembly
I attempting to compile RISC V assembly in Linux using as and gcc.The emulator is TinyEmu and busybox has all the utilities. TinyEmuThe image is diskimage-linux-riscv-2018-09-23.I can get the program...
View ArticleDefine multiple-word macro using -D flag with gcc
The purpose of this is to build a program with command line-injected macros, using a Makefile.I would like to define macros using multiple terms, however I am given an error as subsequent parts of the...
View ArticleStrange character at the beginning of logging - C
I am trying to log whenever a user does something into a log file, with the date included, however when I do this, at the beginning of each log, I get a strange symbol. char log[200]; char...
View ArticleUbuntu 14.04 install gcc-4.5 and g++4.5
I'm trying to install gcc-4.5 and g++-4.5 on Ubuntu 14.04 sudo apt-get install gcc-4.5 g++-4.5 gcc-multilib g++-multilib but the following errors appeared:Package gcc-4.5 is not available, but is...
View ArticleStripping linux shared libraries
We've recently been asked to ship a Linux version of one of our libraries, previously we've developed under Linux and shipped for Windows where deploying libraries is generally a lot easier. The...
View ArticleWhy do we need the DWARF eh_frame emitted by compilers?
I have red that eh_frame is needed for stack unwinding during debugging or when our code hits an exception.Now my questions is, can't the debugger just walk the stack and figure out the boundaries...
View Article