Skip to content

eliminate warnings from the linker #14967

@andrewrk

Description

@andrewrk

Extracted from #14647.

In particular, the one I ran into was this one:

log.warn("directory not found for '-F{s}'", .{dir});

log.warn("directory not found for '-L{s}'", .{dir});

Linker code should not use std.log other than for debug messages, which are disabled in release builds. Instead, it should properly report errors back to the Compilation so that they can be dispatched accordingly. All warnings should become errors, and any such errors that users of the compiler wish to ignore must be addressed via a flag specifically choosing linker behavior to resolve the error. For example, in this case it could be -fignore-empty-lib-directories.

Another example:

zig/src/link/MachO/zld.zig

Lines 1293 to 1294 in b4d58e9

log.warn("requested __PAGEZERO size (0x{x}) is not page aligned", .{pagezero_vmsize});
log.warn(" rounding down to 0x{x}", .{aligned_pagezero_vmsize});

The corresponding flag could be -ffloor-unaligned-segments.

By default, all of the issues should be reported as errors via Compilation's error message API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingImplementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.linking

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions