Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FreeBSD support #63

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Commits on Jun 4, 2022

  1. Check if dli_sname and dli_fname are null pointers.

    On some implementation of `dladdr`, the `dli_sname` and `dli_fname`
    can be null even if the `dladdr` itself succeed.
    michael-yuji committed Jun 4, 2022
    Configuration menu
    Copy the full SHA
    fee7900 View commit details
    Browse the repository at this point in the history
  2. Add preliminary FreeBSD support

    FreeBSD implemented DTrace fairly standardly in compare to Illumos.
    
    1. build.rs
       This patch enable FreeBSD to be treated as a "standard" implementation
       with no linker supported in the usdt build.rs.
    
    2. The values to issue ioctl to dtrace helper are different.
       2.1. The cmd value on FreeBSD is derived the C macro
            `_IOWR('z', 3, dot_helper_t)`;  which is unfolded and the value
            is inlined in this patch.
       2.2 The struct dof_helper is also different, in FreeBSD there are
           two extra fields: `dofhp_pid` and `dofhp_gen`.
    
    3. Linker Issue
       Like Illumos, without `FORCE_LOAD` line the linker will omit the symbols
       (even with "-C link-dead-code"); therefore the line also needed to activate
       on FreeBSD.
    
       There are however still issues in linker that make the FreeBSD support
       preliminary, on FreeBSD the crate consumer need to build with
       "-C link-dead-code", or otherwise the probes will thrown away by the linker.
    michael-yuji committed Jun 4, 2022
    Configuration menu
    Copy the full SHA
    678324e View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2022

  1. FreeBSD: support nightly and stable(link-dead-code)

    Provide a macro version of register_probes!() enables a explicit reference to
    the set_dtrace_probes section from the crate consumer, and prevent lld from gc
    the section. This trick along with the unstable "used(linker)" feature enable
    use on FreeBSD target with nightly toolchain without explicit "link-dead-code"
    
    Since the "used_with_arg" is available only on nightly, a patch is applied on
    usdt-impl/build.rs such that standard backend is enabled only for FreeBSD
    targets that are either on nightly or have link-dead-code explicitly passed to
    the linker.
    michael-yuji committed Jun 6, 2022
    Configuration menu
    Copy the full SHA
    700ca3d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d5c1701 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2022

  1. Remove register_probes! macro, and use R flag for sections instead

    Turns out we do not need all the hacks to get FreeBSD linker working.
    GNU and llvm both support the "R" flag for sections, which prevent
    them from gc.
    
    This make the ugly register_probes! hack obsolete so it can be removed.
    No one deserve to have it in their codebase.
    
    https://lists.freebsd.org/archives/freebsd-hackers/2022-June/001191.html
    michael-yuji committed Jun 7, 2022
    Configuration menu
    Copy the full SHA
    b9910f1 View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2022

  1. Configuration menu
    Copy the full SHA
    d9cd365 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    65f1bfd View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2022

  1. Use libexecinfo to determine dli_sname and dli_fname on FreeBSD

    FreeBSD dladdr(3M) examine dynamic symbol table only hence never give use the mangled symbol.
    Instead, we use `backtrace_symbols_fmt` to give us the symbol.
    
    Handle backtrace_symbols_fmt and ffi a bit more carefully
    michael-yuji committed Jun 10, 2022
    Configuration menu
    Copy the full SHA
    f66766b View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2022

  1. fix formatting

    michael-yuji committed Jun 23, 2022
    Configuration menu
    Copy the full SHA
    0cadb0f View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2022

  1. Cleanup typos and nits

    michael-yuji committed Nov 19, 2022
    Configuration menu
    Copy the full SHA
    2f0774d View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2022

  1. Configuration menu
    Copy the full SHA
    8b02b21 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2023

  1. Configuration menu
    Copy the full SHA
    af5152d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3a3f63b View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2023

  1. Configuration menu
    Copy the full SHA
    bf1ce14 View commit details
    Browse the repository at this point in the history