Tk Source Code

View Ticket
Login
Ticket UUID: bf0f4808d7f3682cb22c44245084c13d76256493
Title: macOS Aqua : CFLAGS_OPTIMIZE
Type: Support Version: trunk
Submitter: nab Created on: 2022-04-20 08:14:05
Subsystem: 83. Mac OS X Build Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2022-04-20 11:12:58
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2022-04-20 11:12:58
Description:
Hi Jan,
in Tk/unix/tcl.m4 in line 1372, CFLAGS_OPTIMIZE is defined as 
CFLAGS_OPTIMIZE="-Os"

Can you please tell me why did you choose -Os over -O2 ?

also when I compile Tk (for Aqua) I used to use:
export CFLAGS="-O2 -mmacosx-version-min=10.15"

which results in -Os -O2.
I can stop to put -O2 in my CFLAGS but are you aware of a better way?

Long time ago I've asked about the -std=gnu99 for macOS Aqua... I've tried with -std=c11 and things are quite ok...
and finally why -lto is disabled? wouldn't we get some advantages to use it?

thanks,
nicolas
User Comments: jan.nijtmans added on 2022-04-20 11:12:58:

Should be fixed [8d00fa2e4bdd5b1c|here]

Now using -O2, and no longer using -std gnu99


nab added on 2022-04-20 10:00:55:
according to this wiki (https://wiki.gentoo.org/wiki/GCC_optimization):
>-Os: optimizes code for size. It activates all -O2 options that do not increase the size of the generated code. It can be useful for machines that have extremely limited disk storage space and/or CPUs with small cache sizes.

Which is not the case on macOS

>> Long time ago I've asked about the -std=gnu99 for macOS Aqua...
>The reason why gnu99 was used in the past is that it included "long long". Now, c11 (or later) should be OK too. But ... why change it?

ok for "long long".
Now it seems that Clang default to -std=gnu17 so maybe it's better to not specify any -std at all for macOSAqua.

and thank you for -lto clarification.

++

jan.nijtmans added on 2022-04-20 09:07:11:
>Can you please tell me why did you choose -Os over -O2 ?

I didn't choose that,  Daniel Steffen did (I guess). I don't know the reason. Any reason to change it?

> Long time ago I've asked about the -std=gnu99 for macOS Aqua...
The reason why gnu99 was used in the past is that it included "long long". Now, c11 (or later) should be OK too. But ... why change it?

> and finally why -lto is disabled?
-lto is not disabled at all. It is only disabled when building the stub library, because -lto only works well when the compiler options used when building the stub library is the same as when building the (stub-enabled) extension. And that is something we don't have under our control.