42,272 questions
Advice
0
votes
0
replies
19
views
Adding stack information to jit'd code for sanitization
Disclaimer: I'm expecting that the answer to this question will be that it can't be done, but I'm asking as a just in case.
I am working on a JIT'd language with the compiler and runtime implemented ...
Advice
2
votes
4
replies
69
views
determine cpu after c++ compilation with gcc?
Does anyone know if there is, in c++, any way to determine at runtime the cpu characteristics of the machine that compiled the code? For example, in gcc (which I'm using) the preprocessor variable ...
3
votes
1
answer
116
views
std::filesystem::path::parent_path() GCC vs Clang behavior with multiple leading separators
I stumbled upon different behavior of std::filesystem::path::parent_path() when a path contains leading slashes. Clang says that the parent of ///a is /// (which is what I would expect), but GCC says ...
0
votes
0
answers
38
views
Linux - Reinstalling GCC with subroutine failing error status 2 [closed]
I've been trying to get a project on my Windows device to run through WSL, and I've been getting stonewalled by C++ compilation errors. I don't understand anything OS-level very well and ended up ...
3
votes
2
answers
186
views
Why do GCC and Clang fail to auto-vectorize simple loop?
I have two functions counting the occurrences of a target char in the given input buffer. The functions vary only in how they communicate the result back to the caller; one returns the result and the ...
0
votes
1
answer
86
views
Linking fails with: in function `main.cold': undefined reference to `__cxa_call_terminate'
I'm trying to build, using CMake, a program involving C++ and CUDA-C++ code. It used to build file, several months ago, but - now am getting a linker error I'm not familiar with:
in function `main....
0
votes
2
answers
80
views
gcc/g++ compiler with POSIX thread model
I'm on Windows OS and in the past month I used to compile a C/C++ project in Qt Creator IDE using MinGW's gcc/g++ compilers based on POSIX thread model, i.e. compilers that were built with the option -...
0
votes
1
answer
19
views
Getting address of special symbols in stripped ELF
I have a program targeting a small memory ARM R5 CPU, being compiled with gcc 11.2.0 and ld 2.37.20210721.
I have a critical symbol that I would like to know the address of, even if the binary was ...
0
votes
1
answer
44
views
Linkage of Win32 api and custom GCC build (StrawberryPerl)
I try to build some source code containig Win32 API code with GCC 8.3.0 (i686-posix-dwarf) that comes with Strawberry Perl Portable package. It easily builds code, but struggles when it comes to ...
4
votes
1
answer
92
views
Why is attribute noinline ignored by gcc-15.1.0 in this example?
Looking at this benchmark about a custom std::function implementation: https://github.com/PacktPublishing/Hands-On-Design-Patterns-with-CPP-Second-Edition/blob/main/Chapter06/09_function.C
I tried to ...
Advice
2
votes
10
replies
380
views
Visual studio vs gcc
I'm a small-scale C programmer at the moment, and I'm bugged by the question: is Visual Studio worth the annoyance that it is?
I've been programming in C and C++ in Visual Studio Code for a while, and ...
2
votes
3
answers
92
views
different behaviour of objcopy with binary output between Windows and Linux
I have created a simple hello.c which contains just the definition of an array:
unsigned char arr[4] = {1,2,3,77};
I have then compiled it with gcc -r in order to produce a relocatable object file. ...
3
votes
0
answers
175
views
What is causing multi single-Byte access to packed Bit-field on GCC as opposed to single double word access on Clang?
While investigating some spurious tests in a x86-64Bit Yocto-based Linux system, that there were multi Byte writes to a register of a PCIe card, instead of an expected single double word write.
A ...
5
votes
1
answer
238
views
GCC -O3: Why does a 32-bit write to a uint64_t appear to be ignored?
I expected this to print 11112222deadbeef (it does at -O0), but at -O3 it prints 1111222233334444.
https://godbolt.org/z/MfeEM8fqP
#include <stdint.h>
#include <stdio.h>
__attribute__((...
0
votes
1
answer
102
views
How to install GCC-Toolset 15 in Oracle Linux 8?
According to OL-PRODUCT-LIFECYCLE.pdf , Table 2-6, GCC-Toolset 15 is available in application stream of Oracle Linux 8.10 .
However, dnf install gcc-toolset-15 fails.
It can be reproduced in a docker ...
1
vote
0
answers
42
views
How can I remove the GCC version strings from executable binaries
on .elf formats, there is a .comment section that includes compiler & linker names and versions, this is fine since its discardable via editing the linker scripts
However on Windows .exe's, while ...
2
votes
2
answers
115
views
Trying to build golang package ending up with GCC compilation segfault on as --gdwarf-5
After some package upgrade on my Ubuntu 24.04 I stumbled upon inability to build/install/work with almost any of golang packages.
So, I'm trying to install staticcheck and get the following error:
$ ...
1
vote
1
answer
55
views
What are the differences between a x86 VxWorks and a Linux object files
There are two ways to create VxWorks applications:
Real-time processes (RTP), which are akin to a process in the Unix world.
Downloadable kernel modules (DKM), which run in kernel mode, akin to a ...
0
votes
0
answers
71
views
Executable killed by the system on Android, but executable via "adb shell"
I have cross-compiled GCC to run on Android arm64 device and i can run it on emulator with "adb shell":
130|generic_arm64:/data/data/com.mycompany.myproject/files/sdk/hardware/tools/avr/bin #...
2
votes
3
answers
180
views
Bitwise operations act outside of type width in C; Compiler Bug or Within Spec?
The following derives from this question but is distinct
Consider the following code sample;
uint32_t *value = malloc(sizeof(uint32_t));
*value = 0xAAAABBBB;
int16_t *subset = (int16_t*) (value);
...
1
vote
1
answer
64
views
Assembly for little-endian xtensa?
I'm trying to assemble some basic testing code for an embedded device I'm reverse-engineering, which runs little-endian xtensa threadx.
From googling the only assembler that seems to support xtensa in ...
0
votes
0
answers
43
views
How to build a gcc_tree_node from custom language Nodes
Nodes:
building a gcc_tree_node for a custom prograimming language
compile and base on C++26
the modules are avilable
the language using tab-block system
every keyword start with '/'
I want to ...
1
vote
2
answers
105
views
Can't get a "ffmpeg_g" file during making a "static" ffmpeg
Currently I'm trying to get a static-linked ffmpeg from source rpi-ffmpeg git.
It's a Raspberry Pi oriented fork of original ffmpeg. And my working environment is RaspiOS (port of Debian "...
1
vote
1
answer
41
views
MinGW CRT: configure: error: cannot compute suffix of object files: cannot compile
I am trying to build MinGW for Linux (MinGW 13.0.0, GCC 15.2). Following the build instructions, I:
Compiled binutils:
../configure --target=x86_64-w64-mingw32 --enable-targets=x86_64-w64-mingw32,i686-...
2
votes
1
answer
98
views
Is there a way to make `gcc -fanalyzer` work across compilation units?
I would like to use gcc -fanalyzer across multiple c-files (*.c). E.g. given the short program
#include <string.h>
int get_buff(int id, int** buff)
{
static int empty[128];
switch(id)
...