Skip to content

issue compiling Debug build, relocation R_X86_64_TPOFF32 against debug.panic_stage cannot be used with -shared #18

@silbinarywolf

Description

@silbinarywolf

The bug

error: ld.lld: relocation R_X86_64_TPOFF32 against debug.panic_stage cannot be used with -shared
    note: defined in C:\Users\User\AppData\Local\zig\o\bf2885e2608e5771377909bcb7e7e5e1\libubsan_rt.a(C:\Users\User\AppData\Local\zig\o\bf2885e2608e5771377909bcb7e7e5e1\libubsan_rt.a.o)
    note: referenced by debug.zig:640 (C:\zig\current\lib\std/debug.zig:640)
    note:               C:\Users\User\AppData\Local\zig\o\bf2885e2608e5771377909bcb7e7e5e1\libubsan_rt.a.o:(debug.defaultPanic) in archive C:\Users\User\AppData\Local\zig\o\bf2885e2608e5771377909bcb7e7e5e1\libubsan_rt.a

It's referring to the threadlocal variable.

/// Counts how many times the panic handler is invoked by this thread.
/// This is used to catch and handle panics triggered by the panic handler.
threadlocal var panic_stage: usize = 0;

Will need to investigate why this doesn't work.

Workaround

  • Do a ReleaseSafe or ReleaseFast build, for libraries like SDL2, just build as "ReleaseSafe" when doing "Debug" build.

Related upstream issue(s):

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