<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 6 April 2018 at 10:32, Paride Legovini <span dir="ltr"><<a href="mailto:pl@ninthfloor.org" target="_blank">pl@ninthfloor.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is manually specifying ‘-buildmode=pie’ in d/rules still the right and<br>
only way to build PIE hardened binaries?<br></blockquote><div><br></div><div>Yes, currently.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
More specifically, what I'm doing is:<br>
<br>
export DEB_BUILD_MAINT_OPTIONS = hardening=+all<br></blockquote><div><br></div><div>We should /probably/ implement processing of hardening flags in dh_golang. It's not done yet though.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed<br>
<br>
GO_LINK_FLAGS += -extldflags "$(LDFLAGS)"<br>
GO_FLAGS += --ldflags '$(GO_LINK_FLAGS)'<br>
<br>
And then:<br>
<br>
dh_auto_build -O--buildsystem=golang -- -buildmode=pie $(GO_FLAGS)<br>
<br>
(Actual d/rules file: <a href="http://deb.li/igtuN" rel="noreferrer" target="_blank">http://deb.li/igtuN</a>).<br>
<br>
This builds fine on my amd64 system, but I'm not sure about other<br>
architectures, and the package hasn't been uploaded yet.<br></blockquote><div><br></div><div>I don't think buildmode=pie has been implemented for mips*, and it's a bit buggy on i386. The others should be fine though...</div><div><br></div><div>Cheers,</div><div>mwh</div><div> </div></div></div></div>