Tk Source Code

View Ticket
Login
2022-04-21
12:55
Fix [bf0f4808d7]: macOS Aqua : CFLAGS_OPTIMIZE. Builds on MacOSX will now be done with -O2 check-in: c3695775 user: jan.nijtmans tags: core-8-6-branch
2022-04-20
11:12 Closed ticket [bf0f4808]: macOS Aqua : CFLAGS_OPTIMIZE plus 6 other changes artifact: 39f2d084 user: jan.nijtmans
11:07
Fix [bf0f4808d7]: macOS Aqua : CFLAGS_OPTIMIZE. Builds on MacOSX will now be done with -O2 and without -std=gnu99 check-in: 8d00fa2e user: jan.nijtmans tags: trunk, main
10:00 Ticket [bf0f4808] macOS Aqua : CFLAGS_OPTIMIZE status still Open with 3 other changes artifact: a48b9019 user: nab
09:07 Ticket [bf0f4808]: 4 changes artifact: 4d7fdda0 user: jan.nijtmans
08:14 New ticket [bf0f4808]. artifact: 08c0d683 user: nab

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.