Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [libc]

The C standard library consists of a set of sections of the ISO C standard which describe a collection of headers and library routines used to implement common operations, such as input/output and string handling, in the C programming language.

libc
3 votes
2 answers
85 views

Interpreting the format specifier in printf("%.-1f", 34.14)

Consider the following invocation of printf(): printf("%.-1f", 34.14); it specifies a negative precision value of -1. Making this call with glibc, we get: %0.-1f is this correct? If so, ...
einpoklum's user avatar
  • 127k
5 votes
1 answer
78 views

Intercept open syscall in C, when called via fopen

I'm trying to code up a (limited) in-memory file system redirects via libc/syscall interception and returning memfd_create-produced file descriptors for the files that are virtualized. As a ...
Vadim Kantorov's user avatar
0 votes
1 answer
79 views

Is there anyway to compile a Rust program without a dependency on a libc for Linux?

Is there anyway I could compile a Rust program to a binary which does not depend on a libc for runtime and for Linux?
Farooq Karimi Zadeh's user avatar
1 vote
0 answers
30 views

Self build toolchains for RISC-V lacking correct libc

I'm trying to bootstrap compile the toolchains for Vortex, which is an open source GPGPU based on RISC-V ISA. I followed the README.vortex in the pocl source file pulled from https://github.com/...
Enki Sun's user avatar
0 votes
0 answers
115 views

What is the difference between libgcc and libc?

I need to use the C standard to compile with my POSIX implementation. I downloaded the precompiled lib of gcc-11.2, but after unzipping, I am facing libgcc.a and libc.a libraries. I tried to compile ...
Eoa's user avatar
  • 1
0 votes
0 answers
16 views

Questions on tls.offset calculation in musl libc

I am reading musl libc source code. In load_library function in ldso/dynlink.c, I noticed a formula calculating p->tls.offset, here is the snippet: #ifdef TLS_ABOVE_TP p->tls.offset = ...
Solomon's user avatar
2 votes
1 answer
102 views

Can I point CMake to use the (older) libc of a different rootfs?

I'm moving this here from the CMake Discourse. I’m trying to set up CMake to cross compile an application that will run on an old (Debian stretch ~2017) Linux system (functioning, but slow, so I'd ...
Alessandro Bertulli's user avatar
0 votes
1 answer
110 views

C++ and syscalls: ignoring return value and checking errno instead

Error checking in C is a task that is very verbose and makes the code unreadable. In C++ you have exceptions, but when I use C++ to call C functions, the headaches come back. I wish there was a "...
ABu's user avatar
  • 11.4k
4 votes
0 answers
87 views

Why is the argument `nelp` in POSIX's `lfind` function (search.h) not `const`?

POSIX Issue 7, 2018 defines the prototype of function lfind in search.h as: void *lfind(const void *, const void *, size_t *, size_t, int (*)(const void *, const void *)); Or, more ...
anol's user avatar
  • 8,736
0 votes
0 answers
117 views

How to install libc debug symbols (libc6-dbg) on Ubuntu 20.04? /usr/lib/debug empty after installing libc6-dbg

I need the debug symbols for libc on Ubuntu 20.04 for performance profiling in gperftools (or perf). I checked how to install them and used: sudo apt-get install libc6-dbg After successfull ...
CodeMonkey's user avatar
  • 4,489
0 votes
1 answer
75 views

Extra Bytes Added to Packet When Sending via Raw Socket

Description I'm currently trying to send packets via a raw socket in Rust. I'm currently using libc to manage the socket. I've had success with sending the packet but the packet sent is never the same ...
petios's user avatar
  • 27
0 votes
1 answer
88 views

Segfault on calling function pointer obtained with dlopen() in Rust

I am currently playing with POSIX functions defined in dlfcn.h with Rust, with the goal of calling a function in a separated .so file. The project actually contains 2 crates: The binary loading the ...
Quentin's user avatar
  • 61
0 votes
2 answers
75 views

Why "all warnings being treated as errors" occurs even added "set(CMAKE_COMPILE_WARNING_AS_ERROR OFF)" to CMakeLists.txt?

I'm building the llvm-18.1.3 and facing the all warnings being treated as errors error as follows: /home/pi/llvm-project-llvmorg-18.1.3/libc/src/stdlib/bsearch.cpp:16:28: error: ‘void* ...
Ueda Takeyuki's user avatar
0 votes
1 answer
67 views

attempting to link libc statically with clang, ldd showing dynamic linking?

I'd like to compile a C program with system libraries (such as libc) linked statically, with all my other custom libraries (such as openssl) linked dynamically. When I compile a "Hello World"...
Austin M's user avatar
1 vote
1 answer
75 views

Compiling without a standard library but with the _start label (entry point)

I am building my own 32-bit x86 OS in which I load user programs from ELF files. When compiling the user C programs I use -nostdlib to exclude GLIBC and link my own LIBC instead. The problem is that ...
Eylon's user avatar
  • 46

15 30 50 per page
1
2 3 4 5
76