121 questions
Best practices
0
votes
1
replies
35
views
In LLD interviews, should class design be driven by domain modeling, database structure, or API/use-case access patterns?
I am trying to understand how Low-Level Design (LLD) should be approached in interviews.
My confusion is that the design changes depending on the perspective I start with.
For example, if I design ...
Best practices
0
votes
2
replies
61
views
Best practice for passing IDs to other entities?
Am I able to pass the entire User to map the payment Info? Is this a good practice, or is there a better way to do it.
public class User {
private Long userID;
private String name;
//DOC ...
5
votes
0
answers
118
views
Why can't rust-lld see symbols in a static build of Libsvtav1?
This is not to Rust-specific; Libsvtav1 built with GCC is not linkable with lld. I am attempting to link a static build of FFmpeg's Libav* libraries for use in a Rust application. I built FFmpeg and ...
5
votes
1
answer
173
views
Cross-compiling SDL3 static library for Windows (x86_64-msvc) with clang on macOS fails with undefined _mm_setr_epi16
I am cross-compiling a Windows x64 GUI executable on macOS (Apple Silicon) using LLVM clang targeting the MSVC ABI, with CMake + Conan 2.
The executable itself compiles and links fine until I add a ...
1
vote
0
answers
112
views
Why does `-fuse-ld=lld` when targeting `aarch64-unknown-linux-musl` cause the binary to dynamically-link the interpreter?
I've got a working Rust cross-compile setup on Arch Linux, targeting x86_64-unknown-linux-musl and aarch64-unknown-linux-musl from a x86_64 host.
By default, binaries for both targets are fully ...
0
votes
2
answers
91
views
Which design pattern can use for search overloading function? [closed]
In a interview, someone asked me this situation. How can you improve this.
search with many filter condition design pattern
Eg: let say search a gym by it distance, by its pincode, by its name, by its ...
2
votes
0
answers
300
views
Unable to cross compile simple C program using clang and lld
$ cat hello.c
int main ()
{
return 0;
}
$ clang -fuse-ld=lld -target ppc64le hello.c -o hello.o
ld.lld: error: /tmp/hello-37cf01.o is incompatible with elf64-x86-64
collect2: error: ld ...
0
votes
1
answer
92
views
lld cannot find -lgtest -lgtest_main
My environment is wsl2 Ubuntu22.04 LTS, compiler is clang-18.1.8, ld is LLD 18.1.8
However, when I compile my program, the ld output:
: && /usr/local/bin/clang++ -fPIC -stdlib=libc++ -g -Wall -...
-1
votes
1
answer
158
views
LLVM linker does not work on MacOS while trying to develop on-chain Solana app (C++)
this is the error i get:
./account_logger.so ()
dyld[61282]: Library not loaded: @rpath/libLLVM.dylib
Referenced from: <A9E4BE2A-BF8D-3956-BCA9-E3BC5A6C9F9C> /Users/myusername/.local/share/...
1
vote
1
answer
491
views
`__DATA_CONST` error while linking library to pybind11 module on Mac OS M1
I am trying to develop a library for Mac OS for scientific computation. It works and compiles file on Linux, but for some reason I am getting weird errors on Mac.
ld: __DATA_CONST segment missing ...
0
votes
1
answer
446
views
How can I configure the linker in CMake so that it uses g++ instead of ar + c++?
My problem is, that I want to use lld as dropin linker in my mingw installation. So I've copied the lld.exe as lld.exe, ld.lld.exe and lld-link.exe to my mingw bin directory (only one of them is ...
0
votes
0
answers
195
views
llvm18 ffat-lto-objects undefined vtables
Hi there!
I am porting a project from an old c++ version to a new one, using the newly went out llvm 18 suite.
For this, I would like to enable LTO optimizations, however, due to practical reasons, I ...
0
votes
0
answers
143
views
LLD: How to Use –dll and –add-stdcall-alias Swiches
I tried to build a project using LLVM that is originally built using GCC, but I met some errors related to LLD when linking. It uses --dll and --add-stdcall-alias to the linker, but LLD can't ...
1
vote
1
answer
232
views
How can I get clang compiler / lld linker for riscv32 to not use an lui for every memory address in the same range?
I'm writing a standalone program for a risc-v core that has many writes and reads to two different memory ranges. (One range is for ram, and the other is for peripherals. Maybe there will be more ...
0
votes
1
answer
361
views
ld can't find symbol, but lld can, why? (MinGW64 library on MSYS2)
On the MSYS2 shell, ld fails to link a simple binary:
$ clang++ -iquote /mingw64/include -L /mingw64/lib -lLLVM-16 -x c++ - <<<$'#include "llvm/Support/raw_ostream.h"\nint main() { ...
0
votes
1
answer
75
views
Object not callable in Python Abstraction
Hi can someone tell me why the below code shows the error, I think this should run fine -
from abc import ABC, abstractmethod
class DriveStrategy(ABC):
@abstractmethod
def drive_strategy(self):...
-2
votes
1
answer
71
views
What is the design approach for this problem statement? [closed]
Currently there are 200 customers and each of them have their own code base which has almost exact same code. The level of differences are as follows
There are values in app.config and based on that ...
1
vote
2
answers
1k
views
Why does MSVC Linker (and lld-link) behave weirdly when entry point is manually set?
I was trying to compile a program in Windows using clang so that I can use cmdline options similar to gcc while statically linking to the UCRT library (ucrt.lib). Besides, I also want to specify the ...
1
vote
0
answers
2k
views
strange rust-lld error in no_std environment
I'm trying to use rust-lld to link a custom kernel written in Rust and I'm getting this weird error:
error: linking with `rust-lld` failed: exit status: 1
|
= note: LC_ALL="C" PATH="...
0
votes
0
answers
132
views
How can I place my variable into a specific section using lld or mold linker?
A.ld
SECTIONS
{
.rel.rodata.func_reg : {
PROVIDE(func_reg_start = .);
*(.func_reg.aaa.*)
PROVIDE(func_reg_end = .);
...
}
}
INSERT AFTER .text;
A.hpp
typedef ...
1
vote
1
answer
1k
views
Clang with Address Sanitizer on Windows fails at link time
I have the following setup:
clang:
clang version 16.0.6
Target: x86_64-pc-windows-msvc
Thread model: posix
windows (not sure if relevant):
Windows 10 Version 22H2 (OS Build 19045.3086)
CMakeLists.txt:...
0
votes
1
answer
3k
views
Why is lld saying unknown file type?
Could anyone help me on why ld.lld is telling me:
clang -ffreestanding -mno-red-zone -m32 -c kernel/main.cpp -o kernel.o
ld.lld -m elf_i386 -T kernel/linker.ld -o kernel.bin kernel.o
ld.lld: error: ...
13
votes
1
answer
14k
views
Does rust use lld linker as standard
I have started on the "zero to performance in rust" book. This discusses using the lld linker instead of the standard rust linker to speed up compile times. However, the book is now about a ...
2
votes
1
answer
540
views
Problem with OMNeT++ installation on Ubuntu: How to resolve 'Standard C math library -lm not found' error during ./configure?
I have a problem with the installation of OMNeT++ on Ubuntu. The error occurs during the ./configurecommand and relates to the math library: configure: error: Standard C math library -lm not found.
I ...
0
votes
0
answers
77
views
surviving symbols in GC-section
i am writing proposal for GSOC, in project i have to preserve surviving symbol during "-print-gc-sections", so need to know what is surviving symbols?
0
votes
1
answer
773
views
Is it possible to tell a linker to use libraries with some duplicated symbols as if the symbols were actually different?
We are distributing four different static libraries to customers:
Library A: contains some common functions but also some embedded common libraries from linux which are not intended to be exposed to ...
1
vote
0
answers
797
views
lld-link error: undefined symbol: __sbsan_handle_out_of_bounds
I'm trying to test clang's -fsanitize=array-bounds compiler flag with some c99 code on Windows but I can't compile due to a linker error. My test code is this:
int index = 11;
int arr[10] = { 0 };
...
1
vote
2
answers
8k
views
ld.lld: error: undefined symbol: __divdi3
I'm trying to link two risc-v elf files together with ld.lld, but ld.lld is giving me the following error:
ld.lld: error: undefined symbol: __divdi3
I suppose that I need to link my files with some ...
1
vote
2
answers
108
views
Detect when linking a binary has finished by looking at just the executable?
The build tool for the language in which our project is written does compilation and linking in parallel, for a number of different binaries and so on. In CI we have a separate thread that looks for ...
0
votes
1
answer
390
views
Error in Simu5g and Veins5.2 make on the Omnetpp IDE
I am getting the following error in Simu5g make on Terminal.
libsimu5g.so file is not build at the end.
Creating shared library: ../out/clang-release/src/libsimu5g.so
ld.lld: error: unable to find ...
1
vote
1
answer
217
views
Adding a new LLVM target to llvmlite
Is it possible to add a new target to llvmlite (python library)?
For a new hardware (e.g. ASIC), I need to have a new and custom LLVM target.
This is not very clear from the documentation.
If it is ...
0
votes
2
answers
3k
views
How to handle .debug_info relocation R_X86_64_32 out of range: 4295935474 is not in [0, 429496729]
I am building a cpp project, but the link fails, because the .debug_info segment is too large, exceeding 2^32-1. Is there a tool to locate which part of the code has a larger .debug_info segment, or ...
0
votes
1
answer
359
views
ERROR:relocation R_X86_64_PC32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
I am getting a make error while running omnetpp.
I have turned the clang and the lld off. The exact error is:
Creating shared library: /home/ash/omnetpp-master/out/gcc-release/src/sim/liboppsim.so
/...
4
votes
1
answer
5k
views
argument unused during compilation: '-fuse-ld=lld'
I have successfully built clang and lld from source, and both are now available under my .../llvm-project/build/bin directory.
Following lld documentation, I am now trying to pass -fuse-ld=lld command ...
1
vote
0
answers
1k
views
linking against different libc++ for clang14 on macOS 10.13
edit: My question is not related to Link errors using <filesystem> members in C++17 at all!
-lstdc++fs is not available on clang14 for macOS 10.13
edit2: Latest Xcode for macOS 10.13 is clang10, ...
4
votes
1
answer
4k
views
Error linking .o file to .wasm with wasm-ld
I've been trying to convert a cpp file to wasm without emscripten recently and I've been running with some errors, for example, when I run these commands:
clang++ --target=wasm32 -nostdlib -O3 -o ...
0
votes
0
answers
313
views
how to skip incompatible architecture when linking with lld
I have a lib that provides both libxxx_x86_64.a and libxxx_arm64.a. When linking using ld x86_64.a is skipped,
ld: warning: ignoring file _pod_work_dir/Pods/____/libs/______x86_64.a, building for ...
0
votes
1
answer
193
views
Darwin `ld` stubbornly won't find symbol that's defined in object file, while `lld` does
When using macOS's built in ld, I get the following error:
ld -arch x86_64 -platform_version macos 11.0 12.2.1 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/...
8
votes
1
answer
5k
views
lld runs LTO even if -fno-lto is passed
I have a CMake project with several subprojects that create static libraries built with -flto=thin.
The project has a lot of tests that are linked against the aforementioned libraries. With LTO it ...
1
vote
0
answers
2k
views
clang failed to invoke lld correctly
I prepare two very simple c files, main.c and test.c, and use the below command to compile them:
clang --target=aarch64 -c main.c
clang --target=aarch64 -c test.c
But when I use the command clang --...
0
votes
2
answers
1k
views
Which design pattern to use for pre-process process and post-process task
I am working on one migration engine to migrate data from older system to newer system. it is divided into 3 steps.
first getting the data from older tables.
prepare the request body to insert into ...
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
255
views
LLVM's lld don't know --dll-search-prefix=cyg
The good news, I was able to compile and install Clang and lld from branch llvmorg-12.0.1 under Windows / Cygwin.
It compiles my code fine but linker says:
lld: error: unknown argument: --dll-search-...
0
votes
1
answer
22k
views
LLD undefined symbol when attempting to link glfw
I've been trying to get an LLVM toolchain setup on my Windows 10 machine. I gave up on building from source and have the MSYS2 mingw-w64-clang-x86_64-toolchain package installed (clang version 13.0.0)...
3
votes
1
answer
374
views
LLVM linker places stack in the wrong place
I am trying to link Cortex-M4 firmware with clang + lld. The gcc build works fine. I am using the stock CMSIS linker script with only RAM & ROM size adjusted (bases are the same). Beginning of the ...
3
votes
2
answers
1k
views
llvm linker(lld) mapfile format explanation
I want to parse the lld mapfile. Is there an explanation or documentation?
I checked clang documentation and lld documentation but failed to find helpful infomation.
Here is an example of my mapfile
...
0
votes
1
answer
665
views
LLD link failure ( expected, but got ) at KEEP(*.init_array)
I am trying to build firmware for Cortex-M0 with clang. The gcc build works of course fine. The build fails during linking
ld.lld: error: baremetal.ld:72: ( expected, but got )
>>> KEEP(*....
2
votes
2
answers
2k
views
Accessing `__heap_base` when building a `.wasm` binary with Rust
Wanted to follow what it is done in this article: https://surma.dev/things/c-to-webassembly/ but with Rust and write a custom allocator.
For that I would need to access __heap_base variable that llvm ...
1
vote
0
answers
645
views
is there an environment variable I can passs to cmake that will make clang use lld and not ld?
is there an environment variable I can passs to cmake that will make clang use lld and not ld?
I want something that I can use with CC and CXX and will accomplish the same thing as fuse-ld=lld.
3
votes
0
answers
2k
views
Why gcc linker instead of ld.lld is invoked when target is specified in clang command?
Helllo,
On my WSL2 ubuntu 20.04 system, when I use the following command to invoke ld.lld, everything is OK:
clang -fuse-ld=/usr/local/bin/ld.lld ....
But when the option "--target=aarch64" ...