Bug#653846: Please add an option for dpkg-buildflags to emit a different optimization level

2012-01-02 Thread Moritz Mühlenhoff
On Mon, Jan 02, 2012 at 12:59:16PM -0600, Jonathan Nieder wrote:
> Moritz Muehlenhoff wrote:
> 
> > Is the evaluation order of GCC options properly specified, i.e. is there
> > a guarantee that -Os overrides the previous -O2
> 
> Yes.
> 
> (From the manual:
> 
>   "If you use multiple -O options, with or without level
>   numbers, the last such option is the one that is effective.")

Thanks. That's a good solution, then. I'll add this to the "hardening
conversion docs" I'm planning to work on next weekend.

Cheers,
Moritz 



-- 
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#653846: Please add an option for dpkg-buildflags to emit a different optimization level

2012-01-02 Thread Jonathan Nieder
Moritz Muehlenhoff wrote:

> Is the evaluation order of GCC options properly specified, i.e. is there
> a guarantee that -Os overrides the previous -O2

Yes.

(From the manual:

"If you use multiple -O options, with or without level
numbers, the last such option is the one that is effective.")



-- 
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#653846: Please add an option for dpkg-buildflags to emit a different optimization level

2012-01-02 Thread Moritz Muehlenhoff
On Mon, Jan 02, 2012 at 01:50:47AM -0600, Jonathan Nieder wrote:
> Raphael Hertzog wrote:
> > On Sat, 31 Dec 2011, Jonathan Nieder wrote:
> 
> >> It's perhaps ugly, but DEB_CFLAGS_MAINT_APPEND=-Os works fine for me.
> >
> > Why would it be ugly? I think that's the correct interface to change the
> > optimization level.
> 
> Because the resulting compiler command line contains both -O2 and -Os.
>
> But yes, I agree it's less ugly than any alternative I can imagine.

Is the evaluation order of GCC options properly specified, i.e. is there
a guarantee that -Os overrides the previous -O2 or is this undefined
behaviour, which just happens to do the correct thing in this case?

If not, this has the potential for subtle bugs and build failures
with new GCC releases.

Cheers,
Moritz



-- 
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#653846: Please add an option for dpkg-buildflags to emit a different optimization level

2012-01-01 Thread Raphael Hertzog
Hi,

On Sat, 31 Dec 2011, Jonathan Nieder wrote:
> Moritz Muehlenhoff wrote:
> 
> > One recurring issue I found in many rules files is that they're
> > building with different optimization levels other than O2. In most
> > cases it's -O3 or -Os.
> >
> > In such cases, maintainers have to query dpkg-buildflags and substitute
> > the output with the optimitation level of their choice.
> 
> It's perhaps ugly, but DEB_CFLAGS_MAINT_APPEND=-Os works fine for me.

Why would it be ugly? I think that's the correct interface to change the
optimization level.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Pre-order a copy of the Debian Administrator's Handbook and help
liberate it: http://debian-handbook.info/liberation/



--
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#653846: Please add an option for dpkg-buildflags to emit a different optimization level

2011-12-31 Thread Jonathan Nieder
Moritz Muehlenhoff wrote:

> One recurring issue I found in many rules files is that they're
> building with different optimization levels other than O2. In most
> cases it's -O3 or -Os.
>
> In such cases, maintainers have to query dpkg-buildflags and substitute
> the output with the optimitation level of their choice.

It's perhaps ugly, but DEB_CFLAGS_MAINT_APPEND=-Os works fine for me.



-- 
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#653846: Please add an option for dpkg-buildflags to emit a different optimization level

2011-12-31 Thread Moritz Muehlenhoff
Package: dpkg-dev
Version: 1.16.1.2
Severity: wishlist

Hi Raphael,
I've started to submit patches to enable hardened build flags. After
having converted approx. 50 packages I've found the interface useful
and convenient, thanks for implementing it!

One recurring issue I found in many rules files is that they're
building with different optimization levels other than O2. In most
cases it's -O3 or -Os.

In such cases, maintainers have to query dpkg-buildflags and substitute
the output with the optimitation level of their choice.

It would be good if there were an option like --optimisation-level=3,
so that dpkg-builflags would e.g. emit CFLAGS as 
"-g -O3 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security 
-Werror=format-security"

Cheers,
Moritz



-- 
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org