@jhx You asked for it, so I'll answer it:
Imho, C++ design is broken from the very beginning. It wanted to provide #OOP language constructs, still maintaining full #C compatibility (which already failed many years ago, cause the languages took different roads).
It combines #exceptions (IMHO generally a bad idea) with explicit resource management (an *awful* idea, forcing you to use #RAII which will in turn mandate creation of purely "technical" classes, just to manage resources).
It wanted #generics, but that's impossible without breaking C compatibility, so it came up with #templates, actually a #preprocessor on steroids.
Overloading also doesn't fit into the simple C library ABI (where #linker symbols are named just like the function), so it came up with "name mangling" ... which is especially horrific because it is *not* standardized.
Ah well, I could go on 😂
#oop #c #exceptions #raii #generics #Templates #preprocessor #linker
@StompyRobot @zeux And they just changed their license to MIT, so hopefully that will help with contributions & adoption.
Unable to link C source code with ADA static library (Error: libnewapi.a(unit1.o):unit1.adb:undefined reference to `__gnat_rcheck_CE_Overflow_Check') https://stackoverflow.com/questions/76738346/unable-to-link-c-source-code-with-ada-static-library-error-libnewapi-aunit1-o #ada #programming #linker-errors #gnat #gcc #ada #c
#ada #programming #linker #gnat #gcc #c
#clang #ld #linker question: If I create a dylib libD.dylib that links against static libS.a, by default libD will contain a copy of all (referenced) symbols from S, and any users of libD would not need to link S to get all their needed symbols.
Is there a way to make ld *not* include a copy of S in D (i.e. leave D’s references to symbols in S as unresolved externals)? It’s OK that users of D need to also link S; I want to make sure that there’s only one copy of the contents of S in the final executable.
The obvious answer is to turn S into a dylib as well, but I want to know if there’s actually a way to do what I want.
Apple has released a new linker, and it's pretty fast, https://twitter.com/davidecci/status/1665835119331135488 and https://twitter.com/rui314/status/1665929739155177472.
They claim it's 5x faster than ld64.
Image showing a benchmark from Rui (mold's author).
It's a good time to continue my work on `weld`, https://fosstodon.org/@hywan/109783158363196851 and https://github.com/Hywan/weld.
New Video about Dynamic Loading
Video: https://youtu.be/VO6gMLtQOKM
Code: https://github.com/simonracz/dynamic-loading
This is mostly for C and C++ devs, although I briefly mention other languages as well.
It's about the dlopen(), dlsym().. APIs and their many use cases.
#linux #C #C++ #dlopen #linker #dynamic #loading #java #android #live #streaming
#linux #c #dlopen #linker #dynamic #loading #Java #android #live #streaming
Self-Modifying Code in Assembly on Linux. (23 min)
Video: https://youtu.be/PhMZYrzJBC8
#linux #assembly #elf #linker #gdb
Ich habe schon früher daran gedacht, aber angesichts der Verweigerung liberaler Politker bei den Koalitionszielen des Bundes fällt mir auf, daß man sehr leicht erkennen kann, mit was für einem Liberalen oder Demokraten man es zu tun hat. Ich glaube fest daran, dass jeder #Liberale entweder ein stiller #Rechtsextremist oder ein falsch verführter #Linker ist. Beim Bundes-Haushaltstheater müssen wir schleunigst herausfinden, wer wer ist, denn das Klima schenkt uns keine Zeit für diese Spiele.
#liberale #rechtsextremist #linker
Well, I say #linker, what it does is concatenate files, occasionally leaving a blank space in between. It’s like how I once manually linked a program by gluing #PaperTapes together. It doesn’t resolve any symbols, I use the #assembler’s diagnostic output and a small #awk script to do that and pass the results back in to the assembler so symbols are resolved at “compile” time. The important bit is that all the bytes are in the right place in the ROM image.
#linker #papertapes #assembler #awk
My biggest difficulty with linkers is… understanding their errors! I know I'm not alone.
That's why `weld` must be exemplary on errors, period.
Please welcome `weld-errors`, https://github.com/Hywan/weld/compare/b7fde2dbf9fb523dccb041063bfd030967f5e814...4a41bd666c6dc8b76a59bf7c127247312e84127e.
What's new?
* Any error contains a code, a (formatted) message, and a help message,
* `weld` pretty prints those errors,
* `weld --explain <error_code>` gives detailed diagnostics,
* Automatic awesome documentation.
See the screenshots.
#weld #rustlang #error #diagnostics #friendly #linker
`weld` now takes a `--target <triple>` argument. `weld` is designed to be cross-platform entirely, hence it's legit to be able to specify a target triple, https://github.com/Hywan/weld/commit/b7fde2dbf9fb523dccb041063bfd030967f5e814.
Based on the provided target triple, `weld` will use a particular linker strategy (e.g Elf, MachO, Coff, Wasm etc.).
$ weld --target x86-64-unknown-linux <input> -o <output> # = Elf
$ weld --target aarch64-apple-darwin <input> -o <output> # = MachO
Cool huh?
#weld #rustlang #targetlexicon #crossplatform #linker
Sie sind vom #Herz en #Linker / #Linke, der sich Gedanken um #sozial e #Gerechtigkeit und #Verteilungsgerechtigkeit macht, und wollen sich informieren, welche #Analyse ergebnisse auf dem #Wissen s #blog #Zukunftshebel: #Mensch, #Wirtschaft, #Technologie und #Natur auf Sie warten? Kommen Sie doch vorbei. https://marius-a-schulz.de/artikeluebersicht/#Linke
#herz #linker #linke #sozial #gerechtigkeit #verteilungsgerechtigkeit #analyse #wissen #blog #zukunftshebel #mensch #wirtschaft #technologie #natur
Sie sind vom #Herz en #Linker / #Linke, der sich Gedanken um #sozial e #Gerechtigkeit und #Verteilungsgerechtigkeit macht, und wollen sich informieren, welche #Analyse ergebnisse auf dem #Wissen s #blog #Zukunftshebel: #Mensch, #Wirtschaft, #Technologie und #Natur auf Sie warten? Kommen Sie doch vorbei. https://marius-a-schulz.de/artikeluebersicht/#Linke
#herz #linker #linke #sozial #gerechtigkeit #verteilungsgerechtigkeit #analyse #wissen #blog #zukunftshebel #mensch #wirtschaft #technologie #natur
The last couple of weeks I've learned more about #linker scripts and the #NXP IMXRT1176 boot process than I ever wanted to know. But it's always nice if you get paid to learn. 😄
The culmination today was the creation of a second stage bootloader to be able to load an #ECC protected boot image from #SPI flash to ECC RAM.
Yesterday, I’ve also added support for big- and little-endian. All parser combinators can now handle endianness based on a generic type + trait, https://github.com/Hywan/weld/commit/5a1ff9f9643fe6b82e7b789e4c2cca7ee6615024.
It’s magic. Rust is cool.
#linker #parser #elf #rustlang
So far, I’m writing the Elf64 parser. The goal is to get zero copy, period.
Yesterday I’ve added section’a data and name, still with zero copy, https://github.com/Hywan/weld/blob/bfb9fd55c5b2f9114e8f8ab21c5f49d48f9c3b98/crates/parser/src/elf64/mod.rs#L720.
It relies heavily on Rust lifetimes, and bstr to get bytes-based string-ish. The parser is written with nom, and is manipulating bytes slices only.
bstr: https://blog.burntsushi.net/bstr/
nom: https://github.com/rust-bakery/nom
#linker #parser #elf #rustlang
I’m starting a new project to learn about linkers. It’s called ˋweld`, and it lives here https://github.com/Hywan/weld.
I do this on my free time; understand very sporadically.
This toot is a thread to show progress or to ask help.
"Among the architectures now supported by Mold include DEC Alpha, 32-bit Arm, AArch64, 32-bit x86, m68k, PowerPC 32-bit, PowerPC 64-bit, RISC-V, s390x, SH-4, SPARC 64-bit, and x86_64." 😍 https://www.phoronix.com/news/Mold-1.9-Released
Working with them now to get them set up with a permanent #s390x VM so they can continue the support they added in October 2022 #Mold #linker #s390x