Skip to content

eliminate warnings from the linker #14967

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

Closed
Tracked by #14647
andrewrk opened this issue Mar 17, 2023 · 2 comments
Closed
Tracked by #14647

eliminate warnings from the linker #14967

andrewrk opened this issue Mar 17, 2023 · 2 comments
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. enhancement Solving this issue will likely involve adding new logic or components to the codebase. linking
Milestone

Comments

@andrewrk
Copy link
Member

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.

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. breaking Implementing this issue could cause existing code to no longer compile or have different behavior. linking labels Mar 17, 2023
@andrewrk andrewrk added this to the 0.11.0 milestone Mar 17, 2023
@kubkon
Copy link
Member

kubkon commented Mar 18, 2023

Not sure about the flags but the error messages mirror what you get from the system linker on macOS. Totally agree we should use the Compilation error reporting mechanism though.

@andrewrk andrewrk modified the milestones: 0.11.0, 0.12.0 Apr 9, 2023
@kubkon
Copy link
Member

kubkon commented Aug 31, 2023

Solved by #17020

@kubkon kubkon closed this as completed Aug 31, 2023
@andrewrk andrewrk modified the milestones: 0.14.0, 0.12.0 Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. enhancement Solving this issue will likely involve adding new logic or components to the codebase. linking
Projects
None yet
Development

No branches or pull requests

2 participants