Returns without a "return" command
C programming language, compiled with gcc, terminal bash in WSLI have written a recursive function, to find the lowest number in an array, which works just fine. /*01*/ int minimo(int array[], int n)...
View ArticleAdding multiple ARM toolchains to path
So I am aiming to compile armv2 32 bit on my Mac such that it does not use the FP register which I have been told was not in earlier versions of arm 32 by my instructor.I am thinking that if I use an...
View ArticleI need to use regex for c++ code with GCC 4.1.2
I need to use a regex library for c++ code with GCC 4.1.2. I read online that there isd the STL regex library for C++ was introduced in GCC 4.3 under Technical Report 1 (tr1). Can I package tr1 regex...
View ArticleWhy can't local variable be used in GNU C basic inline asm statements?
Why cannot I use local variables from main to be used in basic asm inline? It is only allowed in extended asm, but why so?(I know local variables are on the stack after return address (and therefore...
View ArticleStruct Memory Allocation in multiple of 2 [duplicate]
Background : Linux - Ubuntu - 64-bit machine - GCC CompilerI'm trying to allocate memory to this structure:struct int a{ int a1, a2; char b1, b2; long int next, next2; }; The actual space required is...
View ArticleRISC-V disassembler doesn't match with spike running results?
I've set up a hello world program just for testing my riscv32-unknown-elf toolchain, spike, pk etc. Though I managed to get the hello world printed using spike --isa=RV32 pk hello.elf, I found out that...
View Articlegetting ld to ignore undefined references when making a shared lib
I'm trying to get gcc's ld to ignore unresolved references when putting together a shared library from a bunch of object files compiled with -fpic flag.I tried a bunch of options so far such as...
View ArticleUse of regex for c++ (not c++11) code with GCC 4.1.2
I need to use a regex library for c++ code with GCC 4.1.2. I read online that there isd the STL regex library for C++ was introduced in GCC 4.3 under Technical Report 1 (tr1). Can I package tr1 regex...
View Article./a.out: Permission denied
I've written a simple hello-world program in C:#include <stdio.h> int main() { /* my first program in C */ printf("Hello, World! \n"); return 0; } I run gcc main.c, and this finishes with no...
View Articlesegmentation fault(core dumped) error while using inline assembly
I'm using inline assembly in GCC. I want to rotate a variable content 2 bits to the left (I moved the variable to the rax register and then rotate it 2 times). I wrote the code below but I faced...
View ArticleExecute binary file inside C code (No system())
I am trying to execute a binary executable file inside C code without using system since it has security and resource management issues.The system used here is Debian Buster with kernel 5.4.0-2-amd64...
View ArticleWhy does gcc produce this weird assembly vs clang?
I was trying to figure out differences between gcc and clang and how they handle std::vector. Can anyone with more knowledge explain why gcc and clang produce such different output?gcc 9.2:...
View ArticleOpenCV image is not showing
I am working on the following code:Main.cpp#include <opencv2/highgui/highgui.hpp> #include <iostream> using namespace cv; using namespace std; int main() { Mat im =...
View ArticleGCC: pc-relative load offset out of range
I am running build on RH7 machine with GCC 4.8.5 version with Arm machine (Architecture:aarch64) Build exiting with below error:/tmp/ccKS41VR.s: Assembler messages: /tmp/ccKS41VR.s:64031: Error:...
View ArticleCinder can not be used when making a PIE object
I followed this article: https://www.libcinder.org/docs/guides/linux-notes/ubuntu.htmlAnd I managed to run basicApp with Cinder. But when I try running it with my own code it gives me the following...
View ArticleGCC add further binary in linkerscript
I got two applications one is a bootloader and second one is an application. This application shall be kept.How can I embed the bootloader binary to the linker script of the application (this is only...
View ArticleWrite inline assembly without clobber lists?
Is it possible to write inline assembly (Intel syntax) with GCC or Clang, without needing to understand the clobber list "stuff"?I'm going to guess "no" because the clobber list "stuff" ensures you...
View ArticleGCC modified/custom target with a custom calling convention on x86-64
I was wondering if it's possible (in a reasonable amount of time) to modify an existing or to define a new build target for gcc. The goal is to do minor modifications like changing the register in...
View Articlewhile compiling a code using gcc on mac OS linker failed in linking custom...
here is the file structure for my project file in c-language : first is a fullCourse folder fullCourse folder contains three folders : 1. include 2. src 3. lib 4. test in include folder : it contains a...
View ArticleHow do I link SDL .a files with GCC?
Not a duplicate; Answers on various forums didn't fix the problem. I am running GCC through commands and I am getting undefined references from SDL even though it appears like I linked SDL correctly,...
View Article