How to place a variable at a given absolute address in memory (with GCC)
The RealView ARM C Compiler supports placing a variable at a given memory address using the variable attribute at(address):int var __attribute__((at(0x40001000)));var = 4; // changes the memory located...
View ArticleGCC accepts index[var] (eg.2[a]), and treats it same as var[index] (eg. a[2])...
I stumbled across a weird behavior of a code snippet that appears incorrect, but is accepted by GCC.The code:int a[100];10[a] = 20; //This line of code, sets the value at a[10] to 20.However, isn't...
View Article(Windows) GCC linker cannot find -lcheck and -lsubunit (But all headers are...
I am trying to compile C code that uses check.h with this command on Windows 11:gcc new_test.c s21_decimal.a -lcheck -lm -lpthread -lsubunit -o new_testBut then i get this...
View ArticleC++ runtime error invalid vptr when compiling with gcc 8.1 and gcc 8.2
I have a strange runtime error that only happens with GCC 8.2 and GCC 8.1.When attempting to delete a class with multiple inheritances, the compiler raises a runtime error related to a corrupted...
View ArticleWhat CPU instruction sets extensions are needed to support the target...
I was looking into Linux support for the RISC-V 32 Bit and came across the following compile instructions:make ARCH=riscv CROSS_COMPILE=riscv32-unknown-linux-gnu- -j $(nproc)The issue is that riscv32...
View ArticleI got "error: no return statement in function returning non-void" on Windows...
I have a c++ code and for some functions, I have not assigned the return type for some functions: setInt (int x){ //this function gives myIntValue a new value myIntValue = x; } setDouble (double x){...
View Articlehow to succesfully compile python 3.x
Upon attempting to compile python 3.7 I hit Could not import runpy module:jeremyr@b88:$ wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz....jeremyr@b88:~/Python-3.7.3$ ./configure...
View Articlextensa-esp32-elf-ld error when linking file with linker script
I'm trying to understand how an esp32 works in low level by writing a simple blinking program in c and by compiling and linking it with xtensa tools. But when I get to the linking step i get a linking...
View Articlecommand '/usr/bin/gcc' failed with exit code 1 in Linux [closed]
I got an error when I used "pip install -r requirements.txt" to install the build dependencies of the code "https://github.com/allenai/sequential_sentence_classification".I used Linux.Ć Running...
View ArticleC Macro with _Pragma fails to compile
I'm trying to define a macro to return the result of a range check which works on signed and unsigned types. However, because I am compiling with -Wextra which includes -Wtype-limits, I want to ignore...
View Articlewhy code is blocked strange in this function
I'm writing a tiny system kernel follow this video:https://www.youtube.com/watch?v=1rnA6wpF0o4&list=PLHh55M_Kq4OApWScZyPl5HhgsTJS9MZ6M.i meet a problem that doesn't emerge in the video: code just...
View ArticleWhere can I find benchmarks on clang vs gcc performence
As the title says, I want to know the speed difference between gcc and clang. Does someone know some websites which make clang vs gcc benchmarks? Google didn't output good resources.(Yes, this post is...
View Article"interrupt function contains function calls" gcc error
In my code I get this"error: interrupt function contains function calls: foo"when compiling with the toolchain: riscv32-unknown-elf-gcc (gcc version 5.2.0 (GCC))but not with this toolchain...
View ArticleWhy does a elf file have so many unsused/wasted space
I've been looking at loading a elf file into the memory, but in the process, I've found out that there is huge chunk of unused space in the file.This is the elf file i got https://cyao.page/kernel.elf...
View ArticleHow does gcov get the gcda file at runtime?
I want dumping gcov data at runtime.I build a libgcov_preload.so using file with the following codeļ¼#include <stdio.h>#include <stdlib.h>#include <signal.h>extern void...
View ArticleHow can I make sure that my struct fits in a memory area defined in a linker...
I'm having a problem very similar to this one, but no answer there is helping me. Building with gcc on ARM Cortex M4.I have:a memory area defined in a linker scripta complex structure, the size of...
View ArticleError Linking a Static File for COBOL DB2 on RHEL
Compiling/Linking COBOL code for DB2 on a RHEL 8.6 server which is hitting an error.Command running:cob2 -F/etc/cob2.cfg -v myfile.cbl -L/opt/IBM/db2/V11.5/lib32 -I/opt/IBM/db2/V11.5/include/cobol_a...
View ArticleChanging array values in C produces "undefined reference to 'memset'" [closed]
I am initializing a 32-element array of 1s and 0s for the starting state for a Game of Life in C. When I use this line:int board[] = {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1,...
View ArticleLinking LLVM causes gcov to fail
Passing --coverage to gcc while also linking LLVM causes an undefined reference to `__gcov_exit' error from the linker. I've set up a fresh project to try to isolate this problem. You can view the...
View ArticleWhy is clock_gettime() not working with MinGW, even though I have time.h
The linker keeps telling me that clock_gettime() is undefined.I have tried using -lrt but then gcc says that it can't find that either.Am I missing some extra library I needed to download?//...
View Article