Does GCC support multiple target architectures?
Is it possible to compile a single gcc (frontend) binary which supports multiple target architectures, which I can select in the command-line, like this:$ gcc --architecture=linux-i386 ...$ gcc...
View ArticleHow to cross compile C to i386 on windows?
I am following a tutorial to create an operating system in C (and a little assembly), and since most of this stuff is done on linux I am having a hard time getting the various tools to work on windows....
View ArticleUnaligned vector pointers oddities (AVX512)
my issue concerns deriving an unaligned __m512 pointer to a memory space containing floats. I find that GCC and Clang are somewhat unstable in generating the correct uop (unaligned vs aligned) when...
View ArticleQEMU GDB step-instruction advances over multiple instructions
I have a pretty trivial bit of bare-metal assembly code running on an arm64 QEMU instance. When debugging with GDB via the QEMU debug port, single step (stepi) is advancing over instructions rather...
View ArticleUndefined reference to SDL2 and pthread functions in Ubuntu
I have a problem linking object files in a C project I've been working on with SDL2 and SDL2 Image. I have been working in Fedora, and the project compiles just fine there. I tried compiling the exact...
View Article"cmath: No such file or directory" when compiled with GCC
I wrote the simple program in linux ubuntu, when I use g++ there is no error but when I use gcc I see this error:test.c:1:17: fatal error: cmath: No such file or directory #include <cmath>Note :...
View ArticleC/C++ with GCC: Statically add resource files to executable/library
Does anybody have an idea how to statically compile any resource file right into the executable or the shared library file using GCC?For example I'd like add image files that never change (and if they...
View ArticleIs there a compiler option that could be used to initialize stack variables...
A common type of bug in C programs is that the program uses some uninitialized data, most often assuming something is zero when it has in fact never been initialized to zero. Such a program can seem to...
View ArticleHow can I access the content of a memory using C/C++?
I want to know the highest address of a RAM. Say I have RAM 4GB (in a 32 bits computer) and 16GB (in a 64-bits computer), but it also shared with display, which is mean that not all the RAM used for...
View ArticleProblem in debugging templates. Build fails specifically for Linux GCC 7, GCC...
My Travis is only failing for Linux GCC 7, GCC 6, GCC 5, GCC 4.9 with errorlibs/astronomy/test/coordinate/equatorial_coord.cpp:22:57: error: template argument 1 is invalid RightAscension<double,...
View ArticleReferencing an aligned empty struct in C?
I came across an odd set of macros in the SameBoy emulator (v0.13) that seems to use an empty struct to address data. It looks like this:#define GB_PADDING(type, old_usage) type...
View ArticleWhat is the default C -std standard version for the current GCC (especially...
When I ask to see the current version of cc I get this.$ cc --versioncc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2Copyright (C) 2012 Free Software Foundation, Inc.This is free software; see the source for...
View Articlepowerpc-eabivle-gcc does not support e_and2i instruction
I am using NXP's GCC 4.9 VLE compiler. I am targeting an e200z7 core. I want to disable 16th bit of the MSR register. Here is what I am using:/* Disable MSR[EE] bit*/ mfmsr r6 e_and2i r6,0x7fff mtmsr...
View ArticleHow to delete pointer to a class without virtual functions and no inheritance
When a class has virtual method, you need to write a virtual destructor to properly free the memory in the destructor.In my case, I don't have a virtual method in the class and neither any sub-classes....
View ArticleError compiling coreutils - error: function might be candidate for attribute...
I try to compile coreutils on Ubuntu 18.4. Here is what I did so far:sudo apt install bison gperf make textinfogit clone git://git.sv.gnu.org/coreutilscd coreutils./bootstrap./configuremakeThis ends in...
View ArticleMinGW compiler not working in sublime and vscode
So I ran the most basic c and cpp code you can run both in sublime text and vs code. And I keep getting the same problem when compiling.The code: #include<stdio.h> int main() { printf("hello");...
View ArticleHow can I find which instruction is crashing my program with an Illegal...
I am using Mingw32 on windows and trying to read the CPU microcode revision.I am getting a crash with illegal instruction (seen via gdb) but I have been unable to determine which instruction is causing...
View ArticleGCC version 4.9 has no installation candidate
I'm trying to install gcc version 4.9 on Ubuntu to replace the current version 7.5 (because Torch is not compatible with version 6 and above). However, even following precise instructions, I can't...
View ArticleHow to convert .s to .asm?
So I was having fun with MikeOS but I suck at Assembly. So I wrote a program in C, and convert it to Assembly with GCC(IN Ubuntu). But when I convert it, it ends up as a .s file. So how do I convert...
View Articlestruct uninitialization issue in c++
I have following struct whose member is another struct:struct SA { ...};struct S { SA a; ...};And in the code I need to reset struct frequently, with:// data memberS m_s;// member functionvoid clear()...
View Article