What does this GCC error "... relocation truncated to fit..." mean?
I am programming the host side of a host-accelerator system. The host runs on the PC under Ubuntu Linux and communicates with the embedded hardware via a USB connection. The communication is performed...
View ArticleHow to use ThrowTheSwitch's Unity C unit testing library?
How to use ThrowTheSwitch's Unity C unit testing library?I'm trying to use ThrowTheSwitch's Unity library to create my unit test in C, but I got some strange errors, but I'm newbie, so this is maybe...
View ArticleSegmentation Fault in using std::filesystem::path [closed]
I know Segmentation Fault is a general error and could be caused by different wrong memory access scenarios. I tried, but couldn't figure out what's wrong with my code.This is the minimum reproducible...
View ArticleHow to align but with offset
Say I need to allocate struct A but b needs to be 4 aligned.struct A{ char a; char b[42];};I guess I can manually pad a pointer returned by malloc(). Any cleaner way? Like gcc's...
View ArticleWhy is the math in my code different when compiling with MSVC versus GCC?...
UpdateI haven't figured out why this issue is happening, but I managed to eliminate it by building the executable as RelWithDebInfo. That is, a release version with debug information. This post gave me...
View ArticleHow to run unit tests on an INSTALLED gcc installation
I am unsure whether a version of GCC installed by my sys admin works correctly, as it gives me exotic errors. is it possible to test that installation (no, compiling a hello world is not enough)?...
View ArticleCan't build Qt-Widgets Application using CMake
I am trying to setup a CMake Project building a Qt-Widgets application but can't compile it properly. My project structure is as...
View ArticleI want to use gcc and gcn in 2 separate steps to compile and link C program
I want to use gcc and gcn in 2 separate steps to compile and link C program.The problem I got is that linker does not find basic C functions like pop, push, isValid, etc,etc,etcI do not want to use...
View Article"scl load gcc-toolset-11" run failed
I want to install gcc-11 in Rocky Linux 8.6.At first, I install gcc-toolset-11,$ sudo dnf install gcc-toolset-11Then I want to load it to the current bash.$ scl load gcc-toolset-11ERROR: Unable to...
View ArticleDisplaying text in command line after executing a .exe file from a compiled...
This might be a dumb question but I'm new to assembly programming and I've converted a .asm file containing the following assembly source code to a .exe file. The code was taken from...
View Articlecompile own ffmpeg filter
I'm trying compile my own ffmpeg filter using official tutorial. My filter uses C++ code. I made header file and adapted my C++ function definition for C. Now I'm trying compile with command make...
View ArticleUnable to see elements of std::vector with gcc in VS code
I'm currently using VS Code to learn C++ because it was easy to setup and is much lighter than VS Studio. However, one thing that I'm unable to do is to see the elements of an array (or string, etc),...
View Articlewhen make elf, link is fail. post R_AARCH64_ADR_PREL_PG_HI21 error
in my asm code, i use _bss_beginadr x0, _bss_beginadr x1, _bss_endwhich is defined in link.ldSECTIONS{ . = 0xffff000000000000; .text.boot : { *(.text.boot) } . = ALIGN(0x00001000); user_begin = .;...
View Articlepowerpc-elf abi instead of elfv2 on 64 bit powerpc systems, is it possible?
I have been trying to cross compile gcc for 64-bit powerpc architecture. However, GCC configuration lacks "powerpc64-elf" target. It has "powerpc64-linux", powerpc-rtems (which can produces 32/64 bit...
View ArticleDetermine data model by C preprocessor
I want to write a .h file conforming to C89 that would be understood by most C preprocessors like gcc, cl (Visual Studio) etc. and that would determine the data model used, i.e. how many bits the...
View ArticleIs there a way to force a variable to be placed at top of .bss section?
I am using GCC on a Cortex M0 from NXP.I have a non-initialized buffer which needs to be placed at 512 byte boundary due to DMA access restrictions:DMA_CH_DESCRIPTOR_T __attribute__ ((aligned (512)))...
View ArticleNew option in GCC : -fsanitize=shadow-call-stack
I have been working with the latest release of gcc (GCC 12.1, released May 6, 2022).There is a new command-line option : -fsanitize=shadow-call-stack.The documentation states:GCC now supports the...
View ArticleHow to change glibc version directory for perl?
Currently, I'm using Ubuntu, and I have a myplatform_sysroot directory used for Qt cross-platform build purposes.And when configuring qt to build I face an issue regarding perl as below:perl:...
View ArticleGcc flag to turn off string constants splitting for optimization
After switching to gcc 8.3.0 I've noticed that some string constants can't be found anymore in the binary file. It turned out that instead of multiple strings like PREFIX_SOMETHING_0,...
View ArticleHow to ensure that RVO (return value optimization) is applied [duplicate]
I am trying to find the best way (i.e. more efficient and preferably more readable) of returning values from a function that has multiple return statements.While playing a bit with different approaches...
View Article