Skip to content

Conversation

@mikdusan
Copy link
Member

closes #17575

@andrewrk
Copy link
Member

Shouldn't options.pie be set to false earlier in the frontend?

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing error when the user specifies -fpie for a non-executable

@mikdusan
Copy link
Member Author

missing error when the user specifies -fpie for a non-executable

ha I actually had that done and took it out.

Do we also want to error for -fno-PIE for non-executables?

@andrewrk
Copy link
Member

no

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep it simple:

const pie: bool = pie: {
    if (options.output_mode != .Exe) {
        if (options.want_pie == true) return error.OutputModeForbidsPie;
        break :pie false;
    }
    if (target_util.requiresPIE(options.target)) {
        if (options.want_pie == false) return error.TargetRequiresPie;
        break :pie true;
    }
    if (tsan) {
        if (options.want_pie == false) return error.TsanRequiresPie;
        break :pie true;
    }
    if (options.want_pie) |want_pie| {
        break :pie want_pie;
    }
    break :pie false;
};

@andrewrk
Copy link
Member

Looks good, thanks!

@andrewrk andrewrk enabled auto-merge (rebase) October 19, 2023 02:58
@andrewrk andrewrk merged commit aa76ca2 into ziglang:master Oct 20, 2023
@IntegratedQuantum
Copy link
Contributor

This change appears to break the thread sanitizer even further:
I was just attempting to look into repairing the thread sanitizer, when I got
error: unable to build TSAN library: OutputModeForbidsPie
It appears that the thread sanitizer builds as a lib, but also requires PIE.

mikdusan added a commit to mikdusan/zig that referenced this pull request Oct 21, 2023
@mikdusan
Copy link
Member Author

This change appears to break the thread sanitizer even further: I was just attempting to look into repairing the thread sanitizer, when I got error: unable to build TSAN library: OutputModeForbidsPie It appears that the thread sanitizer builds as a lib, but also requires PIE.

#17653 should fix it

andrewrk pushed a commit that referenced this pull request Oct 22, 2023
This was missed in #17597 .
@mikdusan mikdusan deleted the issue-17575 branch October 24, 2023 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android link error: relocation R_ARM_TLS_LE32 against tl.foo cannot be used with -shared

3 participants