CMake: use a custom linker
I want to setup a custom toolchain with cmake. I've set the compiler but I don't know how to set the linker. This error is reported because cmake try to use the compiler to link:The C compiler...
View ArticleHow to compile many projects in one makefile
Simple question but I couldn't find any full answer online.I have 3 projects, my desire outcome is that I run make and all 3 programs are transformed into executable files.gcc -o server server.cgcc -o...
View ArticleIs lazy binding really the default for ld?
man ld has the following to say about -z lazy:...tell the dynamic linker to defer function call resolution to the point when the function is called ... Lazy binding is the default.On the other hand,...
View ArticleDockerfile build distutils.errors.DistutilsExecError: command 'gcc' failed...
Using docker to test and develop an ETL data pipeline with Airflow and AWS glue. I'm currently using this blog post as a guide to launch the containers:...
View ArticleConfusion about virtual address space and position indepedent code (PIC)
While reading this blogpost, I came across the following while the author tries to justify the need of PIC for shared libraries.If your shared library is built to only work when loaded at one...
View ArticleWrong .rodata address offset , memory corrupted , linker being naughty
I'm programming my kernel (32 bits x86) , and I am cursed with a problem I can't see how to solve.It's the first time I am confronted with such an issue , usually , I program in user space , so , here...
View ArticleLink against bionic libc on ARM executable
I have a simple Hello World C program:#include <stdio.h>int main() { printf("Hello World!"); return 0;}And I am able to cross-compile it for my Android smartphone using the following...
View ArticleI have made recurrence relation which finds the longest contiguous common...
int lcs(int i, int j, int count) { if (i == 0 || j == 0) return count; if (X[i-1] == Y[j-1]) { count = lcs(i - 1, j - 1, count + 1); } count = max(count, max(lcs( i, j - 1, 0), lcs( i - 1, j, 0)));...
View ArticleString doesn't display to console. Wrong .rodata address offset? Memory...
I'm programming my kernel (32 bits x86), and I am cursed with a problem I can't see how to solve.It's the first time I am confronted with such an issue, usually, I program in user space, so, here it...
View ArticleGCC section attribute on function implementation
Can I use __attribute__((section("name"))) on a function implementation like this:int __attribute__((section("name"))) Foo( void ){ return 1;}This works on arm compiler, see this link...
View ArticleGCC x64 on Windows
I tried installing CygWin64, but I cannot find any executables to build my code with in the C:\cygwin64 directory created.I tried Win-Builds but the setup doesn't load with any mirror I give it. It...
View Article__attribute__((io)), __attribute__((address)) in gcc for AVR don't seem to...
I am trying to use variable attributes specifically provided by AVR flavor of gcc (https://gcc.gnu.org/onlinedocs/gcc/AVR-Variable-Attributes.html#AVR-Variable-Attributes).The manual says that these...
View ArticleHow to create a executable hex from elf file format
I am very very new to this, I have elf file input.out and need to create hex executable from it. I am using objcopy to create executable in intel hex format as followsobjcopy -O ihex input.out...
View Articleerror: unsupported size for integer register
I'm using i686 gcc on windows. When I built the code with separate asm statements, it worked. However, when I try to combine it into one statement, it doesn't build and gives me a error: unsupported...
View ArticleAssembly: Unable to read sectors after the first track
As part of my operating system I wrote this read sector function.It takes a sector address to read from a BIOS device id. But when I set to read from sector 19 (Head: 0, Track: 1, Sector 2) the result...
View Articlehow to use gcc to compile .asm file?
I have some .asm files that use the Intel Assembly format, but I want to compile them by using GCC. Does anyone know how to do this in GCC? I know NASM and YASM are options for this question, but can...
View Articleerror: conflicting types for ‘recdisp’ void recdisp(struct node* p)
void recdisp(struct node* p);struct node{int data;struct node* link;};struct node* head;int main(){recdisp(head);return 0;}void recdisp(struct node* p){if(p==NULL)return; recdisp(p->link);printf("%d...
View ArticleUsing gcc on multiple file objects
In an exam I took I found myself in front of this question:What's the result following this command?gcc file1.o file2.o file3.oA)Nothing, it's using the wrong syntaxB)Links the file objects but won't...
View ArticleHow to trace specific functions/files in C?
I have already known that the GCC's argument -finstrument-functions can hook the functions and the argument -finstrument-functions-exclude-file(functions)-list can exclude some files/functions to be...
View ArticleHow to update GCC in MinGW on Windows?
I'm used to manually install GCC from source before on Ubuntu and it was a painful process. So I really don't want to do repeat this process. Currently, I have MinGW and GCC (4.6.2) installed on my...
View Article