Skip to content

Why is the dynamic linker explicitly overridden? #3

Description

@algorithmiker

wrecc/src/main.rs

Lines 152 to 153 in 37a8413

.arg("-dynamic-linker")
.arg("/lib64/ld-linux-x86-64.so.2")

This explicitly sets the dynamic linker to a fixed value.
This could fail in a few ways:

  • the system only has /lib64/ld-linux-x86-64.so.1 (unlikely)
  • the system doesn't have /lib64/ld-linux-x86-64.so.2 -> like NixOS (which is a linux distribution!), and of course BSDs (if you want to support them in the future).

I did a few tests and it looks like LD has its own logic for resolving a dynamic linker.

man 1 ld also warns against setting your own dynamic linker, saying "The default dynamic linker is normally correct".

By removing these lines, the executables generated by wrecc could run unpatched on NixOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions