sylware / nyanlinux (public) (License: AFFERO GPLv3) (since 2019-09-09) (hash sha1)
scripts for a lean, from scratch, amd hardware, linux distro
List of commits:
Subject Hash Author Date (UTC)
elf toolbox and less toxic format draft a2ab4235350f04975de513911b7a340e2eb50ef3 Sylvain BERTRAND 2023-07-07 17:26:40
update of some image pagkages 7d8a5e8a5e20ab58e585a5f9d4270054285dba8c Sylvain BERTRAND 2023-07-05 23:14:01
gcc 12.2 won't build c++ threading all the time. d8560808bd62a198bc446153602c658141238c01 Sylvain BERTRAND 2023-07-02 16:56:10
Gfx stack update 50e5991a466541ebb88456918f6cc0bad7e1bfb8 Sylvain BERTRAND 2023-07-01 13:19:49
refreshing various components 22c025e6a7019283775b45742a8095a26d1d9b51 Sylvain BERTRAND 2023-07-01 00:16:51
Gfx stack update d91a56e63cb4e61ce950166ee90977f9cb0f7c57 Sylvain BERTRAND 2023-06-24 17:28:11
Gfx stack update 5053fdee70c5a2656a39391f9ec0924b680cb63f Sylvain BERTRAND 2023-06-17 13:08:44
Gfx stack update a8f4d317da64e4728a07332d7b312b0163a9a117 Sylvain BERTRAND 2023-06-10 13:00:40
Gfx stack update 5a50b752ee1174f40b4ac04b0c4ea40def0f003e Sylvain BERTRAND 2023-06-03 13:07:31
Gfx stack update 8d0226a320e934c81b0ffbca7203ab25cfc801ae Sylvain BERTRAND 2023-05-27 13:19:40
Gfx stack update 1b4924dbae0b406ec5f8e9fdc85d0c9c5899d505 Sylvain BERTRAND 2023-05-20 19:39:21
Gfx stack update 98ed4e3167334c8e605f642d8cadb9249078bf84 Sylvain BERTRAND 2023-05-13 14:54:30
Gfx stack update 9adee44d5eb4278e6beb28ec35cae1d7a61bfa49 Sylvain BERTRAND 2023-05-06 17:58:22
Gfx stack update a1e169843a89e65cbeefe0582bc27f5981f2501e Sylvain BERTRAND 2023-04-30 13:34:07
links: 2.29 0b4834c00b761ea5633e94dc31841fe4c0124ac5 Sylvain BERTRAND 2023-04-25 16:27:54
Gfx stack update 1049238ce63d50e058a2f9e96c8651f52c64db15 Sylvain BERTRAND 2023-04-22 17:10:22
Gfx stack update b8b51323aedb5d4c08a829dd52313bc39baa101c Sylvain BERTRAND 2023-04-16 11:21:58
Gfx stack update 21e2397a6d45fa31198beccb2a3673d9dcefaa06 Sylvain BERTRAND 2023-04-02 13:57:56
alsa update: 1.2.8, still crackling sound a2ac619da94ccf6a21a72ef700f5875aadd6085f Sylvain BERTRAND 2023-03-26 17:42:18
Gfx stack update and more b09eed59ad9f0ac877c3756f082fa9d470a856ea Sylvain BERTRAND 2023-03-26 16:34:59
Commit a2ab4235350f04975de513911b7a340e2eb50ef3 - elf toolbox and less toxic format draft
Author: Sylvain BERTRAND
Author date (UTC): 2023-07-07 17:26
Committer name: Sylvain BERTRAND
Committer date (UTC): 2023-07-07 17:26
Parent(s): 7d8a5e8a5e20ab58e585a5f9d4270054285dba8c
Signer:
Signing key:
Signing status: N
Tree: 58b384fbb7ae415d4f2ad7f4e9897ba86d753dfb
File Lines added Lines deleted
files/EDLF64.draft 129 0
files/nyanelf-20230707.tar.bz2 0 0
File files/EDLF64.draft added (mode: 100644) (index 0000000..90f01d6)
1 EDLF64 is the JSON/wayland of the executables and dynamic libraries for 64bits platforms.
2
3 EDLF64=Executable and Dynamic Library Format for 64bits platforms.
4
5 The excrutiating simplicity of the format is intended while doing a good enough job.
6
7 Endianness is the one from the CPU. Offsets 0->edlf_hdr_bytes_n-1 are obviously invalid.
8 ====================================================================================================
9 0x00 "EDLF64",0x00[2],version_b,undef_b[7] (version_b will very probably stay 0x00 forever)
10 0x08 alignment, power of two (then cannot be 0, namely at least 1), from "EDLF64"
11 0x10 mem_bytes_n.
12 0x18 process_entry_file_offset, 0 if this is a dynamic library (register passing, no stack).
13 0x20 resolve_file_offset, 0 if there are no symbols in this edlf64 file.
14 ----
15 0x28 edlf64_hdr_bytes_n.
16 ====================================================================================================
17 A loader64 instance will keep a registry of what was loaded via reference counting. Usually, there
18 will be only one static instance of loader64 per process inited by the process_entry function.
19
20 0x00 uint64_t (*open)( /*INPUT*/ void *pathname, /* we presume the pathname is self-sizing */
21 /*OUTPUT*/ uint64_t *handle, void **start);
22
23 Must be reentrant/thread safe.
24
25 Return 0 if ok, non-zero if an error did happen, and a loader handle and the pointer
26 on the start of the loaded dynamic library, namely the first byte of the loaded dynamic
27 library ELDF64 header.
28
29 Init functions, if any, should be resolved and called right after open. Usually, their C
30 prototypes do include pathname, see below for a recommended init function prototype.
31
32 If pathname targets an already loaded file, the same handle/start will be returned by the
33 loader. On linux, the triplet (dev_major/dev_minor/inode) should defines file system
34 unicity.
35
36 The _CALLER_ may use, on platforms which can support it, the EDLF64_LIBRARY_PATH environment
37 variable to build the pathnames, or any other private means (similar to ELF DT_RUNPATH). See
38 below for a description of the EDLF64_LIBRARY_PATH.
39
40 NOTE: we use a handle, that to avoid to have to map a start virtual address to some loader
41 internals (for instance, the handle could be directly an offset into such internals).
42
43 0x08 uint64_t (*close)(/*INPUT*/ uint64_t handle);
44
45 Must be reentrant/thread safe. Return 0 if ok, non-zero if something wrong did happen while
46 closing the edlf64 file.
47
48 Fini functions, if any, should be called (may be resolved if not provided by init functions)
49 right before the close call.
50
51 Init/fini functions have the responsibility to keep the dynamic library state consistent (for
52 instance using reference counting like a loader instance).
53 ----
54 0x10 loader64_bytes_n.
55 ====================================================================================================
56 EDLF64 is about loading only one RWX memory segment.
57 ====================================================================================================
58 A EDLF64 executable may honor the following environment variable in order to lookup for dynamic
59 libraries. Of course, only on platforms where it is possible. Such incompatible platforms should
60 defines their own EDLF64_LIBRARY_PATH.
61
62 EDLF64_LIBRARY_PATH environment variable to lookup for EDLF64 dynamic libraries: byte string
63 ending with a 0x00 byte. Each path from EDLF64_LIBRARY_PATH is prepended to a dynamic library name.
64
65 We use the char '%' used to escape the path separator ':'. To have a '%' in path, you must double
66 the %, "%%", and to have a ':' in a path not being interpreted as a separator, use "%:". "::" means
67 an empty path, usually the current working directory at the time of the lookup. Any invalid
68 combination of '%' with a non handled char ('%' or ':') will result in the path being skiped.
69 ====================================================================================================
70 Prototype of process_entry function, WARNING, there is no stack, those must be passed in registers.
71 This is, very probably, not a classic ABI function call.
72
73 void process_entry(
74 void *process_info, /* Virtual address */
75 uint64_t process_info_bytes_n, /* size in bytes */
76 );
77
78 process_info is, on compatible platforms, arg,env and aux with their respective data and they are
79 mostly the same than the SYSV ABI (arg has no argc). The process_entry function will have to setup
80 its stack:could be a "mmap" system call or a part of the "bss", namely from the extra memory past
81 the end of the loaded file (including a guard memory page or not), or blunty book some room into the
82 file, etc.
83 On "mmap/munmap" platforms, process_info must be cleanely munmap-able. Other platforms may implement
84 another mechanism to let process_entry remove/free/reuse such bytes from the process.
85
86 For the executable, you may need its path in order to load private dynamic libraries based on
87 its file system location. On linux it is possible only if the /proc file system is mounted and it
88 will target the actual executable via the pathname in the symbolic link /proc/self/exe (all symbolic
89 links were resolved in this pathname). Namely, without mounted /proc, the executable will need a
90 private method to lookup for its private dynamic libraries (similar to ELF LD_ORIGIN environment
91 variable).
92 ====================================================================================================
93 C prototype of resolve function:
94
95 uint64_t resolve( /*INPUT*/ uint64_t *symbol_id,
96 /*OUTPUT*/ void **symbol_virtual_address);
97
98 symbol_id is a 64bits unique id identifying a symbol (similar to kernel syscalls). Like kernel
99 syscalls, those symbol ids must be _EXTREMELY_ stable in time. You could segment the id space with
100 categories (init calls, fini calls, etc, 64bits is huge).
101 Return 0 if ok, with the virtual address of the symbol via the symbol_virtual_address argument.
102 ====================================================================================================
103 Recommended C prototype of an init function:
104 uint64_t init( /*INPUT*/ void *process_info,uint64_t process_info_bytes_n,void *pathname,
105 void *loader64,
106 /*OUTPUT*/ void **fini));
107
108 The process_info here may be a variant from the one provided by the kernel to process_entry.
109 Pathname is a pointer on the pathname used to load this edlf file. If successful, it should return
110 0. Do not expect process_info to stay in memory after the call.
111
112 Alternative C prototype of an init function:
113 uint64_t init( /*INPUT*/ void *process_info,uint64_t process_info_bytes_n,int fd,
114 void *loader64,
115 /*OUTPUT*/ void **fini));
116
117 Same thing than the previous one, but with the process file descriptor used to load/mmap the edlf64
118 file instead of the pathname. You could even add the directory file descriptor.
119
120 Recommended C prototype of fini function:
121 void fini(void)
122 ----------------------------------------------------------------------------------------------------
123 NOTES:
124
125 No static and implicit TLS anymore, explicit initialization is required, for instance via the
126 pthread dynamic library on POSIX-like systems.
127
128 errno would be accessed via an all-thread shared pthread key, or an additional parameter, or
129 bluntly trashed. errno would become a macro using that shared pthread key to get the value.
File files/nyanelf-20230707.tar.bz2 added (mode: 100644) (index 0000000..02de37f)
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/sylware/nyanlinux

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/sylware/nyanlinux

Clone this repository using git:
git clone git://git.rocketgit.com/user/sylware/nyanlinux

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main