42,285 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
53
views
Does the linker option -Wl,-rpath-link=dir need to be given for all the necessary library dependencies search paths?
I have the following project structure, where libb.so depends on liba.so, libc.so depends on libb.so and libd.so depends on libc.so
abcd
├── a
│ ├── lib.cpp
│ ├── lib.o
│ └── liba.so
├── b
│ ├─...
0
votes
0
answers
26
views
Does .rela.rodata relocation apply to .rodata.str1?
I am writing a convertor from Elf32 to Uniflex .r format.
Uniflex .r format does not have read-only data sections so I concat .data, .rodata and .rodata.str together. I apply:
.rela.text to .text
...
1
vote
2
answers
141
views
Detect existence of name in at least one base class
This code (reduced from the Chromium codebase) is accepted by Clang but rejected by GCC:
template<class T> concept Concept = requires {typename T::marker;};
#define INJECT_MARKER using marker = ...
0
votes
0
answers
33
views
No gcc compiling log "CC [M] " showing up when build external modules using linux rpi-5.10.y
environment
OS: Arch Linux x86_64
Host: Windows Subsystem for Linux - archlinux (2.6.2.0)
Kernel: Linux 6.6.87.2-microsoft-standard-WSL2
compiler: aarch64-linux-gnu-gcc 15.1.0 Using built-in specs.
...
4
votes
1
answer
165
views
How to write a static inline macro with compile-time constants?
I am trying to write a C macro (not C preprocessor, but static inline with proper argument type checking) with inline ARM assembly that includes a compile-time constant parameter (to save instructions ...
-1
votes
0
answers
66
views
--specs=nano.specs breaks formatting of 64-bit printf arguments [closed]
When I do printf("%llx", 1LL << 32) on embedded ARM I expect the result of 0x0000000100000000. It works on Max32 microcontrollers.
However, when I try this on an STM32, the ...
2
votes
0
answers
121
views
import std with GCC and CMake on Windows using a hack
I'm eager to compile programs with C++23 import std like
import std;
int main()
{
std::cout << "Hello, modules!\n";
}
using MinGW (g++15.1 or higher) with CMake (4.1 or higher).
...
Advice
0
votes
2
replies
111
views
Is there a race condition in GCC's implementation of std::call_once?
The main lines of GCC's implementation of std::call_once are these ones (with _GLIBCXX_HAS_GTHREADS):
'libstdc++-v3/include/std/mutex:939'
enum _Bits : int { _Init = 0, _Active = 1, _Done = 2 };
'...
2
votes
0
answers
105
views
gcc installed from homebrew seems to be broken in the std library
From my Fedora 42 distro, I am trying to use homebrew to install a specific version of gcc to use in my C++ project. However, I am finding that the homebrew installs of gcc fail when making certain ...
7
votes
1
answer
190
views
Reproducing buffer overflow
Trying to reproduce buffer overflow on Ubuntu 24 for learning purposes.
So the goal is to call call_me_twice second time by passing its address into input string.
$ cat bof.c
#include <stdio.h>
...
1
vote
0
answers
53
views
Readers-writer spinlock implementation for lab locks MIT OCW OS
I am trying to learn some operating system engineering so I came about MIT's operating system engineering course which has been wonderful so far.
The problem I'm having is with the second problem read-...
Advice
0
votes
5
replies
79
views
How can I pack structures/unions by bits in GCC and VC++?
Suppose we have a structure like this:
struct SN {
uint8_t a;
uint8_t b : 4;
}
Now assume we have an array of those structures, for instance std::array<SN, 4> , and the number of ...
4
votes
3
answers
212
views
c++ warning about indirectly taking reference to temporary
I found a bug in some code that was caused by taking a reference to a temporary object, albeit indirectly. The original author had expected this case to be covered by the rule that makes the reference ...
1
vote
2
answers
215
views
Pure Type Punning In C
I want to do pure type punning without memcpy in C using pre-allocated page which I made with mmap() on Linux, because I understand the architecture and how physical ram works, alignment & ...
1
vote
1
answer
87
views
GCC 14.2.0 Coverage (.gcda files) Not Generated at Runtime After Upgrade from GCC 8.5.0 + glibc 2.23
I have created a cflow build and when loading the image in the system, I could see only fewer number of gcda files.
After upgrading from GCC 8.5.0 to GCC 14.2.0, runtime code coverage (.gcda file ...