1,138 questions
1
vote
1
answer
1k
views
Writing and linking shared libraries in assembly 32-bit
I am currently learning assembler for x86 with att syntax. Over the past time I have already written exercise programs without dependencies. Now I wanted to try writing a shared shared-library, as ...
0
votes
0
answers
2k
views
cannot find Scrt.o and crti.o
I am trying to compile my assembly code
global main
extern printf
section .data
msg db "Testing %i...", 0x0a, 0x00
section .text
main:
push ebp
mov ebp, esp
push 123
...
0
votes
1
answer
2k
views
Custom ld-linux.so for subprocesses
I am running a program with a set of custom libraries as follows:
/path/to/my/ld-linux-x86-64.so.2 --library-path /path/to/my/libs /path/to/my/executable
This works great for most of the programs I ...
1
vote
1
answer
1k
views
Compiling old C code Y2038 conform still results in 4 byte variables
According to this overview in order to compile Y2038 conform old code, we just need to add the preprocessor macro __USE_TIME_BITS64 to gcc, but that does not seem to work on an ARMv7 board with Debian ...
1
vote
1
answer
2k
views
Implement of original strlcpy function on Libc
#include <stdio.h>
#include <string.h>
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize)
{
unsigned int i;
unsigned int dst_len;
i = 0;
dst_len = ...
0
votes
1
answer
460
views
Accessing unlinked libc global variable from shell code
Is there any way to find the address of a global variable in libc that hasn't been linked into the executable (therefore not in the got/plt)? I'd like to access the __environ global variable in my ...
0
votes
1
answer
2k
views
Install older version of gcc cross compiler for arm on Ubuntu
I need to use gcc-arm-linux-gnueabi version 6.5, along with a version of libc that came out around the same period (I believe is libc-2.26). My host system is Ubuntu 18.04.
If I go with just a simple
...
0
votes
1
answer
946
views
I cant install cargo afl due to conflict libc in build
i run this command for installing afl but got this error :slight_smile:
cargo install --force afl --verbose
Updating crates.io index
Installing afl v0.12.2
Compiling libc v0.2.119
Compiling semver v1....
1
vote
1
answer
982
views
Can anyone explain the use of libc functions _ldtoa_r and _Balloc?
I am working on a project using the Kendryte K210 which is a 64-bit duel-core RISC-V machine. I am using the Kendryte GNU toolchain and the starting point was the Kendryte standalone SDK.
I am ...
1
vote
1
answer
344
views
2-digit year to 4 digit specifier in strptime
I came across an interesting bug in our code recently.
We parse time-stamps in the format %Y-%m-%dT%H:%M:%S using strptime()
A user entered a 2 digit year by mistake and a very wrong time-stamp was ...
0
votes
0
answers
612
views
Cygwin: C standard library does not support TIME_UTC and timespec_get?
Sample code (t667c.c, taken from here):
#include <stdio.h>
#include <time.h>
int main(void)
{
struct timespec ts;
timespec_get(&ts, TIME_UTC);
char buff[100];
strftime(...
1
vote
2
answers
1k
views
Cygwin: C standard library does not support <uchar.h>?
Scenario:
$ echo "#include <uchar.h>" | gcc -xc - -std=c11 -pedantic -Wall -Wextra
<stdin>:1:10: fatal error: uchar.h: No such file or directory
compilation terminated.
$ gcc --...
4
votes
4
answers
1k
views
Floating point inconsistencies after upgrading libc/libm
I recently upgraded my OS from Debian 9 to Debian 11. I have a bunch of servers running a simulation and one subset produces a certain result and another subset produces a different result. This did ...
0
votes
1
answer
63
views
Should missing definition of object / function with non-reserved identifier lead to diagnostics?
Sample code:
void accept(int x);
int main(void)
{
accept(0);
return 0;
}
Invocations:
$ gcc t719.c -std=c11 -pedantic -Wall -Wextra
<nothing>
$ clang t719.c -std=c11 -pedantic ...
0
votes
0
answers
614
views
"printf.c: no such file or directory" when gdb an assembly code from Professional Assembly Language Chapter04
I've compiled cpuid2.s to cpuid2.o by as cpuid2.s -o cpuid2.o -gstabs
Firstly I linked it by ld -o cpuid2 cpuid2.o -lc but
a message says ./cpuid2:no such file or directory when I executed it
(which ...
0
votes
0
answers
34
views
Find the size of a array without the standard library(in c) [duplicate]
I want to find the size of an array without the standard library(libc). While looking at the musl source code I couldnt find where sizeof() was located.
0
votes
2
answers
1k
views
How to extract and compare the libc versions at runtime?
How to extract and compare the libc versions at runtime with the following restrictions?
stable solution (commands output parsing is discarded as this may vary)
should not rely on executing external ...
6
votes
4
answers
17k
views
GLIBC_2.33 not found in raspberry pi python
Error Trace:
ImportError: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.33' not found (required by /home/pi/.local/lib/python3.7/site-packages/grpc/_cython/cygrpc.cpython-37m-arm-linux-...
0
votes
0
answers
218
views
Paraview crash with Nvidia omniverse connector, possible vtk, qt5, libc error?
I'm trying to install the paraview connector to Nvidia omniverse. Once I load the plugin, it crashes with the following error. It looks like some issues with libc.so or Qt5. But I do not know what ...
1
vote
1
answer
3k
views
glibc versioned symbol and undefined reference to memcpy@GLIBC_2.14
Today, when I use conda zlib to compile a binary, I encountered the error Undefined reference to memcpy@GLIBC_2.14.
.../x86_64-conda-linux-gne/bin/ld: ...envs/myenv/lib/libz.so: undefined reference to ...
0
votes
1
answer
130
views
Beginner issue when linking 7z LZMA SDK to dietlibc
I'm using tcc on sabotage. I use below to link LZMA to dietlibc (the start.o and libc.a from dietlibc are in current path):
tcc -nostdlib start.o LzmaUtil.o Alloc.o LzFind.o LzmaEnc.o LzmaDec.o 7zFind....
1
vote
1
answer
1k
views
libc6 partially installed on ubuntu and I am stuck
I have seen the various standard cures and none of them work. Basic problem:
sudo apt-get --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state ...
2
votes
1
answer
2k
views
mold and lld not linking against libc correctly
I've been writing some x64 assembly on linux - exactly what it is is not relevant - and I've come across a strange problem. In my assembly code, I've declared printf as an external label, and call it ...
0
votes
1
answer
114
views
Can C standard library functions with constant argument(s) be executed at compile time?
Can the following code:
float f = sinf(0.5f);
be optimized to the following code (actually pseudocode to give an idea):
float f = 0x1.eaee88p-2f;
feraiseexcept(FE_INEXACT);
The same principle for ...
4
votes
3
answers
802
views
Is it possible to implement nextafter w/o obtaining a binary representation?
Usually nextafter is implemented in the following way:
double nextafter(double x, double y)
{
// handle corner cases
int delta = ((x > 0) == (x < y)) ? 1 : -1;
unsigned long long ...
0
votes
2
answers
1k
views
Why do I get a segmentation fault when I try to call functions from libc using CDLL in python?
I am trying to call srand function from libc library using CDLL, but I got a Segmentation fault error before actually calling srand.
My code looks like this:
from ctypes import CDLL
import time
libc =...
2
votes
1
answer
2k
views
Unable to open 'libc-start.c'
I'm trying to debug my C code in vscode, and I'm having some problems.
I'm using ubuntu and have gcc and gdb debugger installed. when I start debugging my code and reach to a line with `printf` or `...
1
vote
1
answer
918
views
error: Failed dependencies: /usr/lib/libc.so is needed by devtoolset-8-systemtap-testsuite-3.3-1.el7.x86_64
I was trying to install devtoolset-8 in my slave node with no active internet connection running centos7. I am using all .rpm packages required as dependencies.
During installation through rpm -ivh * ...
-1
votes
1
answer
133
views
In which library write writev and other functions that operate on socket like send also and where is the location of .so file
I like to run this command to look for function names similar to sendfile, send, write writev on my some system library or kernel. command
nm -D /usr/lib/libopenal.so.1 //or T option
But I don't know ...
0
votes
1
answer
535
views
what is `__GI_memset`? why does it cost so much CPU resource?
I'm new to perf, and I'm trying to use it to analyse my programme.
and I got this when running perf top:
PerfTop: 296 irqs/sec kernel:62.8% exact: 0.0% [1000Hz cycles:ppp], (all, 6 CPUs)
-----...
0
votes
1
answer
228
views
RUST error ENOMEM in call of posix_memalign into attached program
I'll try to summarize but it's gonna be complicated.
I'm having an operating system course in my university, and i have a lab work to do.
I'm working in Rust (the lab work is said to be doable in any ...
0
votes
1
answer
1k
views
How do i fix libc abort error when using a simple malloc()
I'm trying to rewrite the printf function. To quickly summarize my approach, I've created a struct that contains the va_list and some other integer variables to contain information about what flags ...
1
vote
1
answer
2k
views
risc-v ld cannot find libc and libgloss
I use window10 with WSL, linux version is ubuntu20.0.4
When I use riscv64-unknown-elf-gcc -lc --verbose to check some information,
The log is as follows :
Using built-in specs.
COLLECT_GCC=riscv64-...
0
votes
1
answer
2k
views
How to compile C program using Clang and libc other than provided by system, eg. musl?
According to clang's documentation,
Clang supports a wide variety of C standard library implementations.
But it lacks the information about how to actually use desired libc.
For example, how to use ...
5
votes
2
answers
8k
views
How to fix "/lib64/libm.so.6: version `GLIBC_2.29' not found"
I'm attempting to use gifsicle in a lambda function utilizing a Node.js 14.x runtime. Executing the function throws the following error:
ERROR /opt/gifsicle: /lib64/libm.so.6: version `GLIBC_2.29' not ...
3
votes
2
answers
1k
views
Build a Linux c++ application runnable on system having libc >= 2.31
I would like to build a C++ application which can be launched on all Linux systems having libc >= 2.31. On my build system (Ubuntu), I have libc 2.34.
Here is my (empty) application:
int main() {
...
0
votes
1
answer
4k
views
glibc on alpine aarch64: gcompat: no such package
I follow official Alpine Linux guide on aarch64 vm (installed from alpine-virt-...iso) but i can't find gcompat package:
myvm:~# apk add gcompat
ERROR: unable to select packages:
gcompat (no such ...
0
votes
2
answers
283
views
Selective linking of C program with C stdlib functions
I'm writing a coding competition grader, in which I want to use gcc to compile a contestant's code and link it with only a restricted subset of C standard library functions. For instance, I only want ...
0
votes
1
answer
357
views
`libc::signal` for `impl` method
I would like to call an impl method on sending a SIGUSR1 signal.
Consider the following example:
use libc::SIGUSR1;
use std::{thread, time};
struct Foo {
}
impl Foo {
fn show(&self) {
...
8
votes
2
answers
3k
views
How to get Linux file permissions in .NET 5 / .NET 6 without Mono.Posix with p/invoke?
I recently found, that I can make Linux system calls from .NET relatively easy.
For example, to see if I need sudo I just make a signature like this:
internal class Syscall {
[DllImport("libc&...
2
votes
1
answer
236
views
Use a static version of libc from an application that uses a dynamic shared library
I am trying to compile the following components:
appl - an application which links to a dynamic shared library (libwrapper.so)
libwrapper.so - A library used by appl. This library invokes functions ...
1
vote
0
answers
764
views
Library not loaded: /usr/lib/libc++.1.dylib when executing Valgrind on Clion Editor
When I execute Valgrind on Clion Editor, the following error shows up.
/usr/local/bin/valgrind --tool=memcheck --xml=yes --xml-file=/private/var/folders/gq/r_j6y6112zlccqkwxp0rj_v00000gn/T/clion-...
0
votes
0
answers
60
views
Compile C programs for Android?
I'm using an aarch64 Linux computer, and my Android phone is also an aarch64 Linux system.
When I compile a simple Hello World program and adb-pull it over to the Android phone and chmod +x it, I find ...
2
votes
1
answer
765
views
Is it possible to override C syscall open without LD_PRELOAD?
The source gets printed, but no open: or open64: gets printed. How to fix this? Thanks!
/*
gcc -o emload emload.c -ldl
./emload
*/
// emload.c
#define _GNU_SOURCE
#include <stdio.h>
#include &...
4
votes
1
answer
3k
views
libc and undefined symbol: stime
I have an python application that uses the FTDI driver library named:
/usr/local/lib64/libftd2xx.so.1.4.22
When I run the application using libc 2.27, it works fine.
When running it against libc 2.32 ...
0
votes
1
answer
1k
views
Including edk2-libc in efi shell application
How would one approach adding support for https://github.com/tianocore/edk2-libc, say I want to include stdio and use printf in my edk2 application? I followed StdLib/Readme.txt, and am able to ...
5
votes
1
answer
1k
views
Should I compile on an old Ubuntu version for maximum `glibc` portability?
I am compiling my Rust code to be used as a CLI.
I want it installable on the widest possible range of x86_64-unknown-linux-gnu based systems, particularly Ubuntu's.
I am using a docker base image ...
0
votes
2
answers
2k
views
Link explicitly to libc (-lc)
Should I explicitly link my program or library against libc, when using libc symbols?
i.e., cc ... -lc
The question applies to the Makefile in case of a program, and both the Makefile and the pkg-...
1
vote
1
answer
2k
views
Why does clock_gettime not compile when using C99?
Why does this C code compile in C99? What should I read to learn more?
I can't post unless I add more text so here's some nonsense text because I don't think there's anything else to say
$ cat m.c
#...
5
votes
1
answer
195
views
Why is `CMSG_SPACE` not a constant function in Rust?
According to the documentation:
pub const unsafe extern "C" fn CMSG_SPACE(length: c_uint) -> c_uint
However, if I compile
fn main() {
let _ = [0u8; libc::CMSG_SPACE(1) as usize];
}
...