14,278 questions
1
vote
5
answers
179
views
How can I tell my compiler or linker, that some symbol reference is only necessary for some function?
Suppose I'm working a library; say it's in C for simplicity. This library exposes and defines two functions:
f(), which calls an auxiliary function aux(), declared but not defined by my library.
g() ...
0
votes
0
answers
39
views
How does cargo and/or link.exe interact together to find a static lib on Windows?
I have a project that fails to build.
PS C:\Users\me\Data\personal\rust\sdl-learn> cargo build
Compiling sdl-learn v0.1.0 (C:\Users\me\Data\personal\rust\sdl-learn)
error: linking with `link.exe`...
0
votes
2
answers
164
views
CPU Mode switches in qemu emulated machine. Undefined behavior. 16 bit code gets executed as 32 bit mode after a far jump
https://github.com/PoutineSyropErable/MapleKernel
The BareBones dir.
debug2 branch.
e5cf6d69e3f9f053 commit hash.
How is a proper 32PM -> 16RM mode switch done on modern x86_64? My 16 bit code is ...
4
votes
1
answer
140
views
How to access global C variables from within standalone assembler modules with the GCC toolchain for Atmel AVR32?
I am currently developing software for the Atmel AVR32 AT32UC3C0512C. The software consists of C modules (.c files) as well as standalone assembler modules (.S files). My IDE is Microchip Studio 7.0....
0
votes
0
answers
46
views
How to override the -fuse-ld flag in CLion?
I have a CMake based Windows library project that only links successfully with the MSVC link.exe due to some obscure third party library dependencies. However, I want to compile the project using the ...
-3
votes
0
answers
68
views
How can I combine my C++ source in debug mode with libraries in non-debug mode?
I am developing a relatively large application using Qt, SystemC, and QCustomPlot libraries. When debugging, it takes a long time for those libraries to load. How can I combine (at CMake level) my own ...
-1
votes
1
answer
94
views
Cannot build shared library with static member function declared in header [duplicate]
Minimum reproducible example:
// dynamic.hpp
class Test {
private:
static void update();
};
// dynamic.cpp
#include "dynamic.hpp"
#include <iostream>
void Test::update() {
...
0
votes
0
answers
63
views
Linker error when importing AWS libraries in Unreal Engine
I am trying to get users to be able to log in via a Cognito account and use those credentials to make calls on a backend API. To that end I have been trying to import the Cognito libraries in an ...
2
votes
1
answer
105
views
Is there a robust way to version all exported symbols with version script without changing the visibility?
GNU documentation is really poor and is worded in a way that seem to imply that you can only assign version only to symbols that are listed explicitly either under global: or local:, but those are ...
9
votes
1
answer
510
views
Link a symbol in C++ to a metadata-defined address
Background
I am working on a C++ project that is injected (via our own loader program that creates the process and loads the code and patches from a DLL the project is compiled to) into a closed-...
0
votes
0
answers
34
views
avr-gcc: error: -fuse-linker-plugin is not supported in this configuration
I'm cross-compiling avr-gcc statically (in order not to depend on Android linker) to work on aarch64 android devices.
gcc is compiled with the flags:
generic_arm64:/data/data/myapp/files/sdk/hardware/...
1
vote
0
answers
74
views
dlsym Not using the symbols loaded by handle, but those already known instead [closed]
I have a project written in C++ which consists in a main application which loads a few plugins. The overview of the problem is as follows:
The plugins, which are shared objects (.so), load without any ...
3
votes
0
answers
107
views
Strange gaps in ARM GCC linker sections
TLDR: On an embedded system, I have to place certain buffers to their own section to be used with DMA. However, the resulting section seems to contain unexplainable gaps. What could be going wrong?
...
4
votes
1
answer
136
views
Is it possible to have GCC inline vectorized trig functions?
Cosine and sine are computed with Horner's method and a Chebyshev polynomial, e.g. a0 + x(a1 + x(a2 + ...))). The fused-multiply add instructions this generates form a dependency chain, meaning we can ...
4
votes
1
answer
102
views
Visual C++ link weirdness with bcrypt.dll
On Windows 11, the BCrypt library contains the Microsoft cryptographic functions. I have noticed a unique behaviour of the linker when linking against bcrypt.dll and I would appreciate the opinion of ...
1
vote
0
answers
106
views
How can I configure a rust application to link against a different version of the CRT?
I have a rust application that I wish to link against a few C++ static libraries. I have my build.rs script triggering the compilation of my C++ libraries which I then link using a cargo command:
...
0
votes
0
answers
25
views
Is it possible to link a dynamic library using a higher version of glibc in a compilation environment with a lower version of glibc?
The scenario is this: My compilation environment is unified, using the lower-level glibc_2.18. I want to depend on a CUDA .so file compiled using the higher-level glibc_2.27.
My runtime environment ...
2
votes
0
answers
66
views
f2py from numpy 2.3.2: Linking a fortran 77 code with many subroutines in separate files fails
I have a large fortran 77 code, "NSCool", distributed among many files which I compile into a python package using f2py. It used to work nicely with python 3.7, then it took me weeks to have ...
0
votes
1
answer
51
views
Why doesn't RTLD_LOCAL solve this symbol conflict when loading dynamic libraries?
I have one dynamic library with the function:
extern "C" void start() {
}
And a second dynamic library with the function:
extern "C" void start() {
}
Exactly the same. I open up ...
0
votes
0
answers
85
views
Cordova and Xcode ios how to modify existing podfile post_install config
How can I add post_install configurations to an existing podfile that already has a post_install section? I need to add a line to fix a build clang ld linker error to debug-iphonesimulator myapp....
6
votes
1
answer
118
views
When inline function definition and extern function declaration are all present in one .c file, no link error is observed
Even though this might look like duplication, I'd claim that it isn't.
Why does a compiler make the Foo function, which is defined in foo.c as inline double Foo() { return 1.2; }, a global function if ...
1
vote
1
answer
71
views
Shared memory between two elf files
I have bare metal project with 2 elf executables loaded in memory.
And I want to share some memory between them (with code and data).
Is it eligible to add object file in some specific section for ...
5
votes
1
answer
196
views
Linking Zig and Go for windows API
I'm trying to link a zig static library with golang. here is my build.zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const windows = b.option(bool, "windows&...
2
votes
1
answer
98
views
How do relocations work for variables initialized to a value that requires relocation itself?
If I have the following code:
#include <stdio.h>
static int order = 5;
char *and_the = "DDD";
int main(int argc, char *argv[])
{
printf("%d\n", order);
printf("%s\...
0
votes
0
answers
70
views
iOS archiving for release strips away global symbols
I have a cocoapods library.
This library has some C functions that I have exposed globally:
#define EXPORT __attribute__((visibility("default"), used, retain)) extern "C"
EXPORT ...
0
votes
1
answer
130
views
Error dynamically loading libatomic.so with musl
Consider this simple build:
#!/bin/sh -eu
: ${CC:=gcc}
cat > libmain.c <<'EOF'
#include <stdatomic.h>
struct two{ long a,b; };
_Atomic struct two atwo;
int main(){ atomic_exchange(&...
0
votes
1
answer
41
views
in CLion, how can I choose a linker other than my C/C++ compiler?
I'm using CLion to build a C++ or a C project. Looking at the project's CMake Profiles, I notice I can choose a toolchain; and looking at the toolchains dialog, I see an entry for choosing a C ...
0
votes
0
answers
23
views
How to build muparser as a static library in CMake? [duplicate]
I've added muparser to my CMake project using the FetchContent module as follows:
FetchContent_Declare(
muparser
GIT_REPOSITORY https://github.com/beltoforion/muparser.git
GIT_TAG master
)
...
1
vote
0
answers
58
views
How to specify custom link line/link order in CMake?
TL;DR: Is there a way to specify custom link order when CMake managed dependencies seems not enough?
I'm developing a toy OS for fun and having trouble linking in the GCC crt* files responsible for ...
0
votes
0
answers
123
views
ld: symbol(s) not found for architecture x86_64, clang: error: linker command failed with exit code 1
I've been using the library SPHinxsys on my MacOS Intel. It worked in the past. However, just recently this error always appears when building:
Linking CXX executable t..._ck/bin/...
0
votes
1
answer
103
views
RISC-V GCC Force Linker Relaxation with GP Register to Address Static Data
I'm writing a bare-metal firmware for a virtual RISC-V SoC. Below is code that communicates with a physical device on the SoC and it is using constant data from the my_data array that sits in ROM. The ...
3
votes
1
answer
135
views
Why does setjmp/longjmp cause 0xC0000028 in LLVM IR?
I write a compiler that generates LLVM IR code and then .obj file. Then I link it with some required .lib files. (msvcrt.lib, ucrt.lib, vcruntime.lib). I declared setjmp and longjmp there as follows:
...
2
votes
1
answer
155
views
Cannot link to just libglfw.so (Have to include libglfw.so.3 as well)
I am making a small application with glfw. I'm not using CMake and instead opted to make a custom build system for more control, but I'm getting an error when trying to run my program:
error while ...
0
votes
0
answers
143
views
iOS Dylib crashes when published to testflight with CODESIGNING 2 Invalid Page
This is a lengthy one. I have basically compiled a Rust binary into a dylib and packaged into a .xcframework that contains per arch .frameworks. This loads correctly when run from Xcode into a real ...
0
votes
1
answer
102
views
MontaVista GCC linker throws `cannot find -lgcc_s`
I have the task of containerizing an ancient embedded build plan which uses the MontaVista GCC toolchain released in 2006. Unfortunately, the senior insists on using a setup similar to the old build ...
1
vote
1
answer
95
views
Duplicates found when linking C++ libraries [duplicate]
I've made a few new classes for help in reading CSV files in a C++ program, based on code suggested in another stackoverflow post here. Here is the file declaring and defining the classes, along with ...
0
votes
0
answers
69
views
Scatter File Organization and Compiling
I'd like to preface this with the understanding that I'm not the most knowledgeable on scatter files, but I've been learning a lot in the ARM forums about them.
I'm working with the STM32F429 ...
-4
votes
3
answers
276
views
Can linking be nested (e.g. by using intermediate object files)? [duplicate]
Commonly the linker is only invoked once. A linear list of input files can be specified for symbol resolution; there are flags for looping through the linker inputs. But for more sophisticated ...
1
vote
1
answer
72
views
Linker placement order is reversed in map file after compiling
I am adding a linker section in the TI arm clang linker and I have added by following
MEMORY
{
TEST_SECTION ( RWIX ) : ORIGIN = 0x41C00000 , LENGTH = 0x00007800
}
--retain="*(....
0
votes
0
answers
157
views
__DATA_CONST segment missing SG_READ_ONLY flag
I'm trying to import a .NET project from iOS native project.
During build time I'm getting linker error: ld: __DATA_CONST segment missing SG_READ_ONLY flag in .../Build/Products/Debug-iphoneos/[...
0
votes
1
answer
92
views
Does the specific linker used affect how asm file is interpreted?
Wondering if the specific linker used affects how asm file is interpreted.
I am using NASM on windows 11, 64-bit, x64 processor. The linker I have is GoLink, but I'm not sure if that's the most ...
0
votes
0
answers
135
views
Libc removed from cyclic dependency group during linking
I am cross-compiling an example project on Linux to target a CortexA72. My project consists of the following files:
/* main.cpp */
int main() { return 0; }
/* syscalls.cpp */
#include <sys/types.h&...
1
vote
2
answers
107
views
Verifying no footprint on production code when optionally adding fault injection
I have the following task: Given source code A, modify it into source code B such that it can optionally enable fault injection. When the fault injection is disabled, it shall output the exact same ...
0
votes
0
answers
61
views
Conflict with QPoint in Qt5Cored.lib despite not including Qt in Visual Studio project (using vcpkg)
I'm working on a simple SDL2 project in Visual Studio using vcpkg for dependency management.
In my vcpkg installation, I have both Qt5 and SDL2 installed. I've used vcpkg integrate install to ...
1
vote
1
answer
55
views
GAS creates a PLT relocation entry for call to an extern symbol?
I assembled the following file with GAS, the GNU assembler:
.extern foo
.global bar
.section .text
bar:
call foo
ret
In the object file it produced there is a relocation entry of type ...
2
votes
1
answer
69
views
Error link 2001 on CLSID from my another DLL
I have 2 DLLs. I want create instance of class in my second DLL that I declare at .idl file of first library. But I get Error Link 2001 on CLSID, when try to link second DLL. I'm linking with first ...
1
vote
1
answer
272
views
Conflicting OPENSSL versions under Linux
I'm building a project linking both with QtNetwork (Qt6) and Python library (3.8).
At runtime, I get the error:
my_prg_bin: symbol lookup error: /lib64/libk5crypto.so.3: undefined symbol: EVP_KDF_ctrl,...
1
vote
1
answer
92
views
Why does my code give multiple definitions error?
I am trying to build the following code on my computer but I run into a lot of errors. The error says that g_tagParams and g_loggerparams are multiply defined in many of the functions. But these two ...
4
votes
1
answer
85
views
ASLR and hard-coded addresses
I wrote the following assembly program (for x86-64 on Linux):
.intel_syntax noprefix
.global _start
.section .text
_start:
mov rax, offset _start
ret
I assembled it using GNU as, and in the ...
1
vote
2
answers
89
views
Need to understand linker behaviour on STM32 project
I recently spent a lot of time solving a problem with an interrupt-handler, and even though I have solved it, I would like to better understand why things went wrong. (It was related to a UART1 ...