Using a shared library within static library used by 2nd shared library and...
Basic question: Can one specify, when building a static library (and ONLY when building the static library), that the static library needs to link with a shared object?I'm working on a project that...
View ArticleCannot use POSIX functions with -std flag with GCC?
My code uses nanosleep(). It compiles fine. And now if I try to compile it with -std=c23 flag, nanosleep() isn't recognized.Any other major C standard version doesn't work. I tried using various...
View ArticleHow -fomit-frame-pointer gcc option could make debugging impossible?
GCC online doc - 3.10 Options That Control Optimization affirm that -fomit-frame-pointer gcc option can make debbuging impossible.-fomit-frame-pointerDon't keep the frame pointer in a register for...
View ArticleWhat is the use of -fsyntax-only option in gcc command?
I read about the -fsyntax-only option in gcc command's man page. I understand it shows errors of missing header files and it ignore the user coding errors. I need to know whether my understanding is...
View ArticleHow do I point R's install.packages() make process to a specific library path?
I'm trying to install the R deldir package on a M1 Mac. I'm unable to install it (unlike most R packages) due to a linker issue:/usr/bin/gcc -dynamiclib -Wl,-headerpad_max_install_names -undefined...
View ArticleStruct is padded to 8 bytes when 6 bytes seem sufficient
In the write-up The Lost Art of Structure Packing, the author introduces struct foo6 (...) in chapter 6 :struct foo6 { short s; char c; int flip:1; int nybble:4; int septet:7;};They explain that the...
View ArticleHow can you determine installed versions of the glibc libraries?
I'm working with an embedded Linux deployment and am using a cross compiler tool chain that doesn't compile I2C library function calls.How do I determine the precise versions of the libraries on the...
View ArticleHow to create and use partially linked object files in CMake?
I am trying to create kernel module for VxWorks. Building simple executable it in my project is a multistep process:compile source filesuse partial linking of the compiled object files, so it creates...
View Articlekernal-headers.rpm is flagging as security vulnerability from Aqua scans for...
We are using the AL2023 image with the GCC package, where kernel-headers is included as an indirect dependency with version 6.1.119-129.201.amzn2023. We are not specifying any version for GCC; it...
View ArticleCompiler optimizations in gcc
I have a code in C and I am running some tests. I need to access an array, but in "read-only" mode. I am doing something like this:for (int i= 0; i < 1000; i++){ int a = shared_array[rand() % 64];...
View ArticleAutomatically unrolling and outputting for C/C++ code
I'm doing an experiment and the first step is to unroll a loop (from C/C++) a dozen of times (ex: 10, 50, etc) and output the C/C++ unrolled code. Is there any tool that I can use to automatize such...
View ArticleHow big before a member function typically not inlined?
How large do member functions need to be before the compiler decides against inlining them?(Assume GCC and o2/o3 or any other high optimization switches).
View ArticleWhat is the difference between the conversion (obj1*)(void*)p and (obj1*)p...
Background:I encountered this in GCC c++ standard library extension pool_allocator.h, which contains an allocator type that utilize memory pool to improve the efficiency of small chunk memory...
View ArticleHow do I fix a declaration error between 2 files that look like they don't...
I'm getting an error in my gcc cross-compiler for i686-elf that is between 2 files that as far as I can see, do not have any links between them.Here's the error message:This is the code from...
View ArticleBuilding a gcc toolchain on a native system, what do I need a target prefix for?
I need someone to set me straight on targets and their prefixes. I build LFS years ago and learned a lot, but targets still confuse me. Last night I build a toolchain locally on an x86_64 redhat 7 box,...
View ArticleDuplicate global variables when using static library in shared library
Say I have a function f() in static library that simply prints how many times it is called.#include<stdio.h>int a = 0;void f() { printf("f at %p was invoked %d times\n", &f, ++a);}It is used...
View ArticlePorting gcc to a new target
I am trying to port gcc to a new target. The target is a new processor we designed our self with a full instruction set. We want to be able to compile c code in gcc for our new processor. To be able to...
View ArticleIteraion 3u invokes unidenified error
#include <iostream> int main(){ for (int i = 0; i < 4; ++i) std::cout << i*5000000000 << std::endl;}getting a warning from gcc whenever i try to run this.:-warning: iteration 3u...
View ArticleWill gcc optimize away repeated function calls upon the same variable with...
For one application, I'm in a situation where the same information exists in multiple forms: Base64 string, hex string, and char[].For now and for productivity's sake, instead of painstakingly...
View ArticleBuilding cross compiler for arm HF
I'm trying to build cross compiler for arm (target=arm-linux-gnueabihf)from GCC 4.6 source code, with option -with-float=hard.My compilation process fails on libgcc (unable to find /asm/errno.h file),...
View Article