News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Any update for PIC/PLT/GOT support for .so support on Linux?

Started by tastewar, July 24, 2021, 11:42:09 PM

Previous topic - Next topic

tastewar

One of the enhancements that was long ago planned for 2.50 was some support for position independent code, which would be helpful when producing linux shared object libraries. Reading through the release notes for 2.50-2.52, and the forum message about 2.53, nothing jumped out at me as evidence of progress in that area.

Did I miss anything, or is it still unsupported? And if it's still unsupported, is there some other way folks are producing .so files for Linux using UASM??

johnsa

There hasn't been any progress on it.
To be honest, I haven't had a good idea for how to actually implement it even.. it is such a STUPID design..
The issue is that it can't be a simple redirection in symbol looks applied by the assembler, as in some cases it needs more instructions to actual make the double de-referencing, clearly the invention of a C++ programmer with no regard for poor assembler guys.

I'd love input on the subject, and of course anyone is free to submit PRs and proposals about how to implement it, even if just how the syntax would work.

LiaoMi

PIC GOT PLT OMG: how does the procedure linkage table work in linux?

0:00 Hi everybody
0:45 Moving an executable from disk to memory
3:03 Loading each ELF segment into memory
3:53 Live demo of loading an executable
9:38 Live demo of running an executable
16:28 What is Dynamic Linking?
17:47 Dynamically vs Statically Linked Executables
20:39 The complexities of dynamic linking and the benefits
22:22 Problems with Shared libraries and shared memory
24:27 Position independent code (PIC)
26:59 Linking dynamic libraries
27:55 Linking at build time & linking at load time
29:50 Global offset table (GOT)
32:45 Linking functions at run time (lazing binding)
34:50 Procedure linkage table (PLT)
37:25 Live demo of PLT and GOT
44:50 Making the common case fast! (Common theme in systems design)
47:50 Why not link global variables like functions or link functions like global variables?

https://www.youtube.com/watch?v=Ss2e6JauS0Y

Good ELF format description - "Learning Linux Binary Analysis" - https://www.amazon.com/Learning-Binary-Analysis-elfmaster-ONeill/dp/1782167102
Executable and Linking Format (ELF) Specification - https://refspecs.linuxfoundation.org/elf/elf.pdf

https://github.com/open-watcom/open-watcom-v2/tree/047386398d3b538c8ba9792714e6143b1f44f0ca/bld/orl/elf
https://github.com/open-watcom/open-watcom-v2/search?q=PLT
https://github.com/open-watcom/open-watcom-v2/blob/047386398d3b538c8ba9792714e6143b1f44f0ca/bld/orl/elf/c/elflwlv.c