• 16 Posts
  • 502 Comments
Joined 2 years ago
cake
Cake day: September 1st, 2023

help-circle












  • EDIT: It does work. My (GNU) libc spits out version info when executed as an executable.

    How does that work? There must be something above ld.so, maybe the OS? Because looking at the ELF header, ld.so is a shared library “Type: DYN (Shared object file)”

    $ readelf -hl ld.so
    ELF Header:
      Magic:   7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00 
      Class:                             ELF64
      Data:                              2's complement, little endian
      Version:                           1 (current)
      OS/ABI:                            UNIX - GNU
      ABI Version:                       0
      Type:                              DYN (Shared object file)
      Machine:                           Advanced Micro Devices X86-64
      Version:                           0x1
      Entry point address:               0x1d780
      Start of program headers:          64 (bytes into file)
      Start of section headers:          256264 (bytes into file)
      Flags:                             0x0
      Size of this header:               64 (bytes)
      Size of program headers:           56 (bytes)
      Number of program headers:         11
      Size of section headers:           64 (bytes)
      Number of section headers:         23
      Section header string table index: 22
    
    Program Headers:
      Type           Offset             VirtAddr           PhysAddr
                     FileSiz            MemSiz              Flags  Align
      LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                     0x0000000000000db8 0x0000000000000db8  R      0x1000
      LOAD           0x0000000000001000 0x0000000000001000 0x0000000000001000
                     0x0000000000029435 0x0000000000029435  R E    0x1000
      LOAD           0x000000000002b000 0x000000000002b000 0x000000000002b000
                     0x000000000000a8c0 0x000000000000a8c0  R      0x1000
      LOAD           0x00000000000362e0 0x00000000000362e0 0x00000000000362e0
                     0x0000000000002e24 0x0000000000003000  RW     0x1000
      DYNAMIC        0x0000000000037e80 0x0000000000037e80 0x0000000000037e80
                     0x0000000000000180 0x0000000000000180  RW     0x8
      NOTE           0x00000000000002a8 0x00000000000002a8 0x00000000000002a8
                     0x0000000000000040 0x0000000000000040  R      0x8
      NOTE           0x00000000000002e8 0x00000000000002e8 0x00000000000002e8
                     0x0000000000000024 0x0000000000000024  R      0x4
      GNU_PROPERTY   0x00000000000002a8 0x00000000000002a8 0x00000000000002a8
                     0x0000000000000040 0x0000000000000040  R      0x8
      GNU_EH_FRAME   0x0000000000031718 0x0000000000031718 0x0000000000031718
                     0x00000000000009b4 0x00000000000009b4  R      0x4
      GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                     0x0000000000000000 0x0000000000000000  RW     0x10
      GNU_RELRO      0x00000000000362e0 0x00000000000362e0 0x00000000000362e0
                     0x0000000000001d20 0x0000000000001d20  R      0x1
    

    The program headers don’t have interpreter information either. Compare that to ls “Type: EXEC (Executable file)”.

    $ readelf -hl ls
    ELF Header:
      Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
      Class:                             ELF64
      Data:                              2's complement, little endian
      Version:                           1 (current)
      OS/ABI:                            UNIX - System V
      ABI Version:                       0
      Type:                              EXEC (Executable file)
      Machine:                           Advanced Micro Devices X86-64
      Version:                           0x1
      Entry point address:               0x40b6e0
      Start of program headers:          64 (bytes into file)
      Start of section headers:          1473672 (bytes into file)
      Flags:                             0x0
      Size of this header:               64 (bytes)
      Size of program headers:           56 (bytes)
      Number of program headers:         14
      Size of section headers:           64 (bytes)
      Number of section headers:         32
      Section header string table index: 31
    
    Program Headers:
      Type           Offset             VirtAddr           PhysAddr
                     FileSiz            MemSiz              Flags  Align
      PHDR           0x0000000000000040 0x0000000000400040 0x0000000000400040
                     0x0000000000000310 0x0000000000000310  R      0x8
      INTERP         0x00000000000003b4 0x00000000004003b4 0x00000000004003b4
                     0x0000000000000053 0x0000000000000053  R      0x1
      LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                     0x0000000000007570 0x0000000000007570  R      0x1000
      LOAD           0x0000000000008000 0x0000000000408000 0x0000000000408000
                     0x00000000000decb1 0x00000000000decb1  R E    0x1000
      LOAD           0x00000000000e7000 0x00000000004e7000 0x00000000004e7000
                     0x00000000000553a0 0x00000000000553a0  R      0x1000
      LOAD           0x000000000013c9c8 0x000000000053d9c8 0x000000000053d9c8
                     0x000000000000d01c 0x0000000000024748  RW     0x1000
      DYNAMIC        0x0000000000148080 0x0000000000549080 0x0000000000549080
                     0x0000000000000250 0x0000000000000250  RW     0x8
      NOTE           0x0000000000000350 0x0000000000400350 0x0000000000400350
                     0x0000000000000040 0x0000000000000040  R      0x8
      NOTE           0x0000000000000390 0x0000000000400390 0x0000000000400390
                     0x0000000000000024 0x0000000000000024  R      0x4
      NOTE           0x000000000013c380 0x000000000053c380 0x000000000053c380
                     0x0000000000000020 0x0000000000000020  R      0x4
      GNU_PROPERTY   0x0000000000000350 0x0000000000400350 0x0000000000400350
                     0x0000000000000040 0x0000000000000040  R      0x8
      GNU_EH_FRAME   0x0000000000126318 0x0000000000526318 0x0000000000526318
                     0x0000000000002eb4 0x0000000000002eb4  R      0x4
      GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                     0x0000000000000000 0x0000000000000000  RW     0x10
      GNU_RELRO      0x000000000013c9c8 0x000000000053d9c8 0x000000000053d9c8
                     0x000000000000c638 0x000000000000c638  R      0x1
    

    It feels like somewhere in the flow there is the same thing that’s happening in python just more hidden. Python seems to expose it because a file can be a library and an executable at the same time.

    Anti Commercial-AI license









  • That’s a well-meaning assumption, but no. My personal experiences asking for help from the linux community are very spaced out, and I understood long ago that asking for a GUI for something in linux is akin to requesting the murder of Torvalds.

    For sure there are lots of people who start using linux and demand it works for their very specific usecase, verbally assault project maintainers, expect they be treated like paying customers despite getting something for free, and just do not understand that many opensource projects are passion projects with no commercial goals. I won’t even get into the FLOSS purists who lose their minds when somebody does want to make money with opensource and dares use a different license.

    But what I see more often is somebody asking for instructions to do something and being told to RTFM, “just do X”, or copy-paste some commands into their terminal. And when the person asks for something without terminal commands, the responses are less than friendly. What worse is when developers suggest building a GUI (or even presenting a GUI) to make things easier for newcomers and advanced users going “but there’s a CLI for that” or “please don’t” or some other response like that.

    And of course this isn’t limited to the OS. As a developer, the “just use vim/emacs” crowd are equally as annoying. Trying to get neovim configured was such a terrible experience I just dropped it. Not only because of neovim itself, but because of the community too. “just learn LUA”, “just copy this into your config, it’s not that hard”, *copy-paste some link to a stack-overflow question that has nothing to do with the question I asked*, etc. . It’s quite similar with the Rust community that would love to lynch anybody using unsafe in their code.

    It’s that unhelpful and dogmatic attitude that I find is pervasive in tech communities. KDE developers and Gnome developers get along well, KDE and Gnome users could wage wars over which DE is the best. Zeus help you if you’re a beginner and get in between.

    Anti Commercial-AI license