gcc on Gentoo defines _FORTIFY_SOURCE as a built-in causing compilation failures when we redefine it

RESOLVED FIXED in Firefox 59

Status

defect
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: gsvelto, Assigned: gsvelto)

Tracking

unspecified
mozilla59

Firefox Tracking Flags

(firefox59 fixed)

Details

Attachments

(1 attachment)

Gentoo's current stable GCC ebuild patches the sources so that _FORTIFY_BUILD is defined as a built-in if __OPTIMIZE__ is set:

https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/5.4.0/gentoo/10_all_default-fortify-source.patch?view=markup

This causes build failures because we re-define _FORTIFY_BUILD at configuration time.
What's correct protocol here? Do we handle this somehow in our config, or should gentoo stop doing this now that it's upstreamed?  (Seems like the latter to me...?)
I don't know, I'm tempted to file a Gentoo bug.
Gentoo should stop doing this.  Until such time, perhaps bootstrap can print out instructions to --disable-hardening?
(In reply to :froydnj (on leave until 2018, ni? or email if necessary) from comment #3)
> Gentoo should stop doing this.  Until such time, perhaps bootstrap can print
> out instructions to --disable-hardening?

That won't work until I figure out how to solve Bug 1418052 :)
Quick update: while the fix for this is trivial, version 6.4.0 of GCC has just been marked stable on Gentoo and from the looks of it it doesn't seem to define _FORTIFY_SOURCE anymore. I'll double-check it later today.
I was wrong, this applies to version 6.4.0 too, updating the title to reflect that. I've got a quick fix almost ready.
Summary: gcc-5.4.0 on Gentoo defines _FORTIFY_SOURCE as a built-in causing compilation failures when we redefine it → gcc on Gentoo defines _FORTIFY_SOURCE as a built-in causing compilation failures when we redefine it
Assignee: nobody → gsvelto
Status: NEW → ASSIGNED
Comment on attachment 8930118 [details]
Bug 1418398 - Always un-define _FORTIFY_SOURCE before defining it;

https://reviewboard.mozilla.org/r/201288/#review206516
Attachment #8930118 - Flags: review?(mh+mozilla) → review+
Thanks Mike!
Pushed by gsvelto@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6c027fdb55dd
Always un-define _FORTIFY_SOURCE before defining it; r=glandium
https://hg.mozilla.org/mozilla-central/rev/6c027fdb55dd
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.