ELF: why struct variable is put into section with 32 bytes aligned in 64 bits...
The code:// test.c #include <stdint.h> typedef struct cgi { const char *cgi_name; void *data; uint32_t flags; } cgi_t; static cgi_t a, b, c; compile it:$ cc -c test.c readelf$ readelf -a test.o...
View ArticleRelocation addend in ELF files - Elf64_Rel vs Elf64_Rela?
ELF files contain two structures to handle relocations:Elf64_Rel:typedef struct { Elf64_Addr r_offset; Uint64_t r_info; } Elf64_Rel; and Elf64_Rela:typedef struct { Elf64_Addr r_offset; uint64_t...
View Article"TERM environment variable not set" error in C compiler [closed]
I get this error while compiling C program using gcc compiler in Linux system. The error arise after I add the following statement. 1.system("clear"); I have included required header file also.Error:...
View Articlelink time warning about VPF registers
I'm trying to port a project from Cortex M0 to Cortex M4 with hardware floating point extension, the new target soc is nRF52832.The error I am getting from the linker is the...
View ArticleHow to build gcc to get correct names of binaries?
I'm trying to build gcc-9.2.0 on a Ubuntu 18.04.4 LTS computer from source, with the compiler gcc-7.4.0 that was installed from the offical repo of Ubuntu.I can NOT exactly distinguish the difference...
View ArticleBuilding gcc plugin for windows on linux
Try to build the following gcc plugin on linux for windows with mingw cross compiler. The plugins are from the built avr compiler also for windows. Adapted the following plugin...
View Articlecygwin64 :: ./configure returns "configure: exit 77"
I've installed Cygwin64 and I now would like to install extundelete.So I downloaded it, decompressed the file, but when I run ./configure it says:$ ./configure Configuring extundelete 0.2.4 configure:...
View ArticleExplanation of Asm code
The following GCC inline asm is taken from LuaJit's coco library. Can someone provide a line by line explanation of what it does?static inline void coco_switch(coco_ctx from, coco_ctx to) { __asm__...
View ArticleGNU linker: do not count section as bss
Consider the following linker script which I have written for an ARM based microcontroller:/* Configure memory regions */ MEMORY { RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K BKPRAM (rw) : ORIGIN =...
View ArticlePreventing Compiler from optimizing code without the use of volatile
I'm trying to create a kernel from scratch (just trying something new)Everything is ready now and I'm testing the output and noticed something very weirdI build my files with:gcc ./kernel/kernel.c...
View ArticleClang on Windows with MinGW
I have both MinGW gcc and Clang clang installed and added to path via chocolatey, and both can be found on the command line. However, when I try to use clang with gcc, clang doesn't seem to know where...
View ArticleError building gcc 4.8.3 from source: libstdc++.so.6: version `CXXABI_1.3.8'...
I 'm using gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010 for the compile but I have also tried gcc 4.1.2 and I get the same error.for gcc 5.2.1 strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6|grep...
View ArticleAVX 256-bit vectors slightly slower than scalar (~10%) for STREAM-like double...
I am new to AVX512 instruction set and I write the following code as demo. #include <iostream> #include <array> #include <chrono> #include <vector> #include <cstring>...
View Articlelinker complaining about maybe uninitialized variable (fully optimized build...
I was compiling some code that did previously compile (with the same options), and after some unrelated changes, the linker started finding a variable that may be uninitialized (I suspect those...
View ArticleARM compilation error, VFP registers used by executable, not object file
I have been having this problem for the last few days and I can't get my head around what is really happening here, or what is the problem.I have a makefile with these flags:CC =...
View ArticleELF: How to print the r_info field?
I want to list the name of all relocation entries which have the type R_X86_64_JUMP_SLOT. Here's what I have so far:char *str = (char *) (mapped_file + dynstr->sh_offset); Elf64_Rela *reloc_entry =...
View Articlebuiltin pcmpistri not working in gcc
I'm trying to write a strcmp version that takes advantage of SSE4.2 new instructions leveraging GCC intrinsics.This is the code I have so far:#include <stdio.h> #include <smmintrin.h> int...
View Articlelinking in linux using gcc
I'm trying to run my very first c++ program in linux (linux mint 8). I use either gcc or g++, both with the same problem: the compiler does not find the library I am trying to import. I suspect...
View ArticleMy compiler is giving me an error about multiple definitions of functions
I am new to C and am trying to create a makefile. I have to compile the following files: A2.c (functions) a2_q1.c (consists of the main function) and a2_q1.c (consists of another main function). This...
View ArticleHint the C compiler (GCC or Clang) of possible variable value/range
In the following code, only one comparison will be done, because the compiler knows the conditions are exclusive and we will always enter the second condition as bar will be necessary > 32:int...
View Article