Skip to content

unable to link shared object for mipsel-linux: lld: error: can't create dynamic relocation R_MIPS_32 against symbol: DW.ref.__gxx_personality_v0 in readonly segment #4925

@andrewrk

Description

@andrewrk
#include <iostream>

int main() {
    std::cout << "Hello World!" << std::endl;
    return 0;
}
zig build-lib -dynamic --c-source hello.cpp -lc++ -lc -target mipsel-linux-musl

It outputs this error many times. Here are the first 3:

lld: error: can't create dynamic relocation R_MIPS_32 against symbol: DW.ref.__gxx_personality_v0 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o
>>> referenced by hello.cpp
>>>               zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o:(.eh_frame+0xAB0B)

lld: error: can't create dynamic relocation R_MIPS_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o
>>> referenced by hello.cpp
>>>               zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o:(.eh_frame+0xAB25)

lld: error: can't create dynamic relocation R_MIPS_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o
>>> referenced by hello.cpp
>>>               zig-cache/o/wBiI-p6eCZdmTuXt5tRTRWO2FhNemqh2pP_OHQZkLg3tpaS7QxKY8XE-koliaV8r/hello.o:(.eh_frame+0xAB55)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions