Post AS5pr4LQppZ5rL0yVU by rygorous@mastodon.gamedev.place
(DIR) More posts by rygorous@mastodon.gamedev.place
(DIR) Post #AS5pqqmDHSfXmLRAJ6 by rygorous@mastodon.gamedev.place
2023-01-27T21:17:33Z
0 likes, 0 repeats
Welcome to object file formats, where everything is named confusingly for historical reasons
(DIR) Post #AS5pqrCngbw76nsOkS by rygorous@mastodon.gamedev.place
2023-01-27T21:21:07Z
4 likes, 7 repeats
".text" sections don't contain text. ".data" contains some but not all data. ".bss" stands for block started by symbol, a directive in one particular assembler for the IBM 704 (1954!) that just.. stuck around.Object files are files but neither are nor contain objects (in the modern sense). Core dumps are memory dump but they've not been dumps of (magnetic) core memory since the 70s.There are segments and sections, which mean slightly different things in every format.
(DIR) Post #AS5pqrihlzSOhknsTg by EthanIClark1@mastodon.gamedev.place
2023-01-27T22:53:05Z
0 likes, 0 repeats
@rygorous not to mention that a .obj file is a common format used for 3D models AND an “object file” that compilers generate, which adds an extra layer of comedy.It’s probably not possible, but a compiler that generates .obj files that are valid for both uses would be funny.
(DIR) Post #AS5pqs5OPdbZq7PzqC by publius@mastodon.sdf.org
2023-01-28T06:16:07Z
0 likes, 0 repeats
@EthanIClark1 @rygorous I've seen "Obfuscated C Competition" and similar stunt programming which suggests it may be possible after all.
(DIR) Post #AS5pqvriMR2ZYr384m by rygorous@mastodon.gamedev.place
2023-01-27T21:22:30Z
0 likes, 0 repeats
There are COMDAT sections, which stands for COMMON DATA, originally meant to implement FORTRAN "COMMON" blocks. These days they're almost exclusively used for non-data (namely ".text", which as said before is also not text) so that's cool
(DIR) Post #AS5pqxTKO4ioXnegLI by rygorous@mastodon.gamedev.place
2023-01-27T21:27:01Z
1 likes, 0 repeats
Everything has headers with like 20+ fields. Compiler and assembler authors look at those 20+ fields and go "well I know what to put in like 5 of these but for the rest, uh, beats me".Then linkers and OSes "well I need maybe these 5 fields to actually do my job and will just ignore the rest"The other 15 fields are just along for the ride, tools often put something in there but you usually can't trust it, and nobody's sure why they exist, it just seemed like a good idea at the time
(DIR) Post #AS5pqz8UCXErhjv48O by rygorous@mastodon.gamedev.place
2023-01-27T21:31:23Z
0 likes, 0 repeats
There's relocations. Originally, these are metadata used to move code built to run in one (memory) location to another. Fine. That's still a thing actually, so that part's fine.Then there are the _other_ relocations. These are other random metadata that have nothing to do with relocating code, but they're used to patch certain magic values in for things like thread-local storage. These are esoteric af and if something gets them wrong all hell breaks loose.
(DIR) Post #AS5pr0v5ZJi7ElfOWu by rygorous@mastodon.gamedev.place
2023-01-27T21:39:48Z
1 likes, 0 repeats
A lot of info you would expect to be there either just plain isn't, or if it is it has to be awkwardly encoded into strings (name mangling), because this stuff was all originally designed to bolt FORTRAN code together with 5 assembly routines, and neither types nor stacks were a common feature.
(DIR) Post #AS5pr2fZ40TsfCQ1bs by rygorous@mastodon.gamedev.place
2023-01-27T21:43:11Z
1 likes, 0 repeats
Then there's debug information, which on every platform I've ever worked with always comes in two flavors:1. the old format which can do Assembly and FORTRAN and C code with identifiers <=20 characters, barely knows what types are, and is flat lists of symbol tables and line number info2. the new format meant to support every language under the sun, extended and generalized 20 times, super-expressive and complex, and no two tools agree on how to read or write it
(DIR) Post #AS5pr4LQppZ5rL0yVU by rygorous@mastodon.gamedev.place
2023-01-27T21:44:53Z
1 likes, 0 repeats
lest you think 1. is stabs and 2. is DWARF, that is _one_ example, but I've seen other pairings (for example, on MS platforms, 1. is old-school Codeview and 2. is PDB) and it's always two for some reason
(DIR) Post #AS5pr65YLq3HGfbK2C by rygorous@mastodon.gamedev.place
2023-01-27T21:45:18Z
0 likes, 0 repeats
I guess after how the first rewrite went, everyone decided never to try that again so they just live with the results
(DIR) Post #AS6H3ffuZ615sHpMkC by jsgf@hachyderm.io
2023-01-28T09:19:12Z
1 likes, 0 repeats
@rygorous The best book on the subject doesn't mention x86-64 because... it predates it.
(DIR) Post #AS6H3gCWbq6XVR5PZw by pervognsen@mastodon.social
2023-01-28T09:41:21Z
1 likes, 0 repeats
@jsgf @rygorous I know you're referring to Levine's book, but the best book on the subject is the mold source code. :)
(DIR) Post #AS6H3ghijr3f4BgKCe by Soy_Magnus@detroitriotcity.com
2023-01-28T11:20:59.561519Z
0 likes, 0 repeats
@pervognsen @jsgf @rygorous your all nerds and nigger cattle. Kill yourself :mcnutt_suicide:
(DIR) Post #AS6HRR3wXrTFVNOrCq by lanodan@queer.hacktivis.me
2023-01-28T11:24:46.447030Z
1 likes, 0 repeats
@EthanIClark1 @rygorous At least on Unixes it's .o but file extensions matters much less over here.As for making something valid with both… might be possible if your Wavefront .job parser of choice ignores garbage lines.
(DIR) Post #ASHMU0ro1xvieSBd68 by raggi@don.rag.pub
2023-01-27T22:56:51Z
1 likes, 0 repeats
@rygorous yeah, and/or just didn’t want to deal with rewriting all the tools. Fuchsia went with elf for mostly the tooling reasons. It certainly did avoid the need for a lot of toolchain driver and debug tooling work.
(DIR) Post #ASHMmIFk81Hnmn6FCy by TimWardCam@c.im
2023-01-28T19:13:05Z
1 likes, 0 repeats
@samgai @rygorous Punched cards ...The big problem is when the box of cards falls off the back of your bicycle ... and the cards spill into the gutter ... which is full of liquid mud ...You don't dare put the cards through the reader attached to the mainframe, even after they've dried out a bit, and they jam if you try to duplicate them in the machine that does the interpreting (ie prints the text along the top), so the only way you can recover these soggy cards is to run them through the other duplicator, the one that doesn't do interpretation.Leaving you with 2,000 cards with no printing on and not *quite* in the right order.
(DIR) Post #ASHMmysVeHFdzBYnSq by TimWardCam@c.im
2023-01-28T19:08:36Z
0 likes, 0 repeats
@rygorous Which works fine ... on those days on which everybody agrees which five are the important ones.Which was not the case with, for example, 2G mobile phone protocols, until the industry settled on the Nokia stack as explaining which bits of the standards to take any notice of.
(DIR) Post #ASHMmzQBd4BpfdJgxM by rygorous@mastodon.gamedev.place
2023-01-28T19:10:25Z
0 likes, 0 repeats
@TimWardCam I'm talking about object file formats not comms protocols.
(DIR) Post #ASHMn04bCoW3gyDxwm by TimWardCam@c.im
2023-01-28T19:17:42Z
1 likes, 0 repeats
@rygorous I know. I'm observing that the pattern you describe isn't limited to that domain.