Function add_data_and_relocation

Source
pub(super) fn add_data_and_relocation(
    file: &mut Object<'_>,
    section: SectionId,
    symbol: SymbolId,
    target: &Target,
    kind: SymbolExportKind,
) -> Result<()>
Expand description

Add relocation and section data needed for a symbol to be considered undefined by ld64.

The relocation must be valid, and hence must point to a valid piece of machine code, and hence this is unfortunately very architecture-specific.

ยงNew architectures

The values here are basically the same as emitted by the following program:

// clang -c foo.c -target $CLANG_TARGET
void foo(void);

extern int bar;

void* foobar[2] = {
    (void*)foo,
    (void*)&bar,
    // ...
};

Can be inspected with:

objdump --macho --reloc foo.o
objdump --macho --full-contents foo.o