Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
sys-devel/gcc forced -O2? Upstream?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3945

PostPosted: Sun Sep 22, 2024 10:45 pm    Post subject: sys-devel/gcc forced -O2? Upstream? Reply with quote

I have a feeling sys-devel/gcc forces -O2 as I recently failed trying to change it?

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "


Last edited by CaptainBlood on Mon Sep 23, 2024 11:02 pm; edited 3 times in total
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22757

PostPosted: Sun Sep 22, 2024 11:34 pm    Post subject: Reply with quote

Per eclass/toolchain.eclass, if you do not USE=custom-cflags, then yes, this is forced, because too many people had problems with overly aggressive CFLAGS.
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2873

PostPosted: Sun Sep 22, 2024 11:48 pm    Post subject: Reply with quote

Actually, it has a special rule for -O3 where it'll use the custom target "bootstrap-O3" and then filter it (this lets upstream handle using -O3 similarly to lto with bootstrap-lto). It should use -O3 for most of the build (regardless of custom-cflags), and seems to use it fine for me at a glance.
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3945

PostPosted: Mon Sep 23, 2024 6:23 am    Post subject: Reply with quote

Well,
Code:
equery u
didn't show custom-flags for some reason.
Thus confused pov.

Target is to lower the value here.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3945

PostPosted: Mon Sep 23, 2024 11:00 pm    Post subject: Reply with quote

:oops:
I actually meant forced by upstream, not gentoo portage tree.

custom-cflags in make.conf for years now.

Currently testing with
Code:
emerge --info
Portage 3.0.65 (python 3.11.10-final-0, default/linux/amd64/23.0/split-usr, gcc-13, glibc-2.39-r6, 6.11.0-gentoo-std x86_64)
=================================================================
System uname: Linux-6.11.0-gentoo-std-x86_64-Intel-R-_Core-TM-_i3-6100_CPU_@_3.70GHz-with-glibc2.39
KiB Mem:     3930288 total,   1452196 free
KiB Swap:  200772604 total, 200208364 free
Timestamp of repository gnu-elpa: Mon, 23 Sep 2024 13:04:53 +0000
Head commit of repository gnu-elpa: 91735c2504deb8600cadfa872720b6bf9d07a3e8

Timestamp of repository guru: Mon, 23 Sep 2024 12:34:31 +0000
Head commit of repository guru: 72a9f384ec6107ccbc5a50ef43299d4739d01fc5

Timestamp of repository melpa: Mon, 23 Sep 2024 13:04:53 +0000
Head commit of repository melpa: f691c3bd55901c573549f88627afd128e94943ab

Timestamp of repository mv: Mon, 23 Sep 2024 05:44:47 +0000
Head commit of repository mv: 9395ca144a6b7e47993cad8742f86e80050d3f98

Timestamp of repository gentoo: Mon, 23 Sep 2024 18:15:00 +0000
Head commit of repository gentoo: d77f23603b2349453cefd6a66c05cedd2d6ce227

sh bash 5.2_p32-r1
ld GNU ld (Gentoo 2.42 p3) 2.42.0
distcc 3.4 x86_64-pc-linux-gnu [disabled]
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p32-r1::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.71-r7::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.30.2::gentoo
dev-build/libtool:         2.4.7-r4::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.5.1::gentoo
dev-java/java-config:      2.3.4::gentoo
dev-lang/perl:             5.40.0::gentoo
dev-lang/python:           2.7.18_p16-r2::gentoo, 3.10.15_p1::gentoo, 3.11.10_p1::gentoo, 3.12.6_p2::gentoo
dev-lang/rust:             1.81.0::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54.2::gentoo
sys-apps/sandbox:          2.39::gentoo
sys-devel/binutils:        2.42-r1::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/clang:           15.0.7-r3::gentoo, 18.1.8::gentoo, 19.1.0::gentoo
sys-devel/gcc:             13.3.1_p20240614::gentoo, 14.2.1_p20240921::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             19.1.0::gentoo
sys-devel/llvm:            15.0.7-r7::gentoo, 17.0.6-r3::gentoo, 18.1.8-r4::gentoo, 19.1.0::gentoo
sys-kernel/linux-headers:  6.10::gentoo (virtual/os-headers)
sys-libs/glibc:            2.39-r6::gentoo
Repositories:

gnu-elpa
    location: /var/db/repos/gnu-elpa
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gnu-elpa.git
    masters: gentoo
    priority: -10001
    volatile: False

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo
    priority: -10001
    volatile: False

melpa
    location: /var/db/repos/melpa
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/melpa.git
    masters: gnu-elpa gentoo
    priority: -10001
    volatile: False

mv
    location: /var/db/repos/mv
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/mv.git
    masters: gentoo
    priority: -10001
    volatile: False

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.europe.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-extra-opts:
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24

local
    location: /var/db/repos/local
    masters: gentoo
    priority: 10000
    volatile: False

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O1 -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.9/conf"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.2/ext-active/ /etc/php/cgi-php8.2/ext-active/ /etc/php/cli-php8.2/ext-active/ /etc/php/fpm-php8.2/ext-active/ /etc/php/phpdbg-php8.2/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O1 -march=native -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--alert y          --alphabetical          --ask-enter-invalid          --autounmask y           --autounmask-only n           --autounmask-unrestricted-atoms y     --autounmask-write y        --complete-graph y           --misspell-suggestions n          --noconfmem          --nospinner     --tree          --with-bdeps y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-march=core2 -mtune=native -O2 -pipe -Wa,-mbranches-within-32B-boundaries                                                                                                       "
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live compress-build-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-march=core2 -mtune=native -O2 -pipe -Wa,-mbranches-within-32B-boundaries                                                                                                       "
GENTOO_MIRRORS="http://gentoo.mirrors.ovh.net/gentoo-distfiles/      http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/      http://ftp.halifax.rwth-aachen.de/gentoo/      http://ftp.free.fr/mirrors/ftp.gentoo.org/      http://mirrors.soeasyto.com/distfiles.gentoo.org/      http://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo/      http://mirror.leaseweb.com/gentoo/      http://www.mirrorservice.org/sites/distfiles.gentoo.org/      http://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/      http://mirror.bytemark.co.uk/gentoo/"
LANG="fr_FR.utf8"
LDFLAGS="-Wl,-O1 -Wl,-fuse-ld=mold "
LEX="flex"
LINGUAS="fr"
MAKEOPTS="-j3 -l3"
PKGDIR="/var/cache/binpkgs"
PORTAGE_COMPRESS="lzma"
PORTAGE_COMPRESS_FLAGS="-9"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
RUSTFLAGS="-Ctarget-cpu=native -Cllvm-args=-x86-branches-within-32B-boundaries "
SHELL="/bin/bash"
USE="amd64 asm custom-cflags emacs eselect-ldso fortran gentoo-vm gtk-doc minimal modules-compress modules-sign ocamlopt pgo split-usr test-rust verify-sig" ABI_X86="64" ALSA_CARDS="hda-intel" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" L10N="fr" LUA_SINGLE_TARGET="lua5-4" LUA_TARGETS="lua5-4" PERL_FEATURES="ithreads" PHP_TARGETS="php8-2" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" QEMU_USER_TARGETS="aarch64" RUBY_TARGETS="ruby32" VIDEO_CARDS="intel"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS

echoed build log returns -02 whereas -01 from above is expected.
/etc/portage/package.env has been cleaned up to not interfere.

-march=native is properly taken into account here.

-02 seems hardcoded to me.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2873

PostPosted: Tue Sep 24, 2024 1:09 am    Post subject: Reply with quote

Oh you want -O1, you'll need USE=custom-cflags for that then but the USE is masked so you have to unmask it first for it to take effect if really want that.
Back to top
View user's profile Send private message
stefan11111
l33t
l33t


Joined: 29 Jan 2023
Posts: 934
Location: Romania

PostPosted: Tue Sep 24, 2024 3:47 pm    Post subject: Reply with quote

CaptainBlood wrote:


Why use -O1 globally?
It's not like -O2 is broken or something.

If you're using -O1 to avoid -fstrict-aliasing, you can just put -O2 -fno-strict-aliasing in CFLAGS
_________________
My overlay: https://github.com/stefan11111/stefan_overlay
INSTALL_MASK="/etc/systemd /lib/systemd /usr/lib/systemd /usr/lib/modules-load.d *udev* /usr/lib/tmpfiles.d *tmpfiles* /var/lib/dbus /usr/bin/gdbus /lib/udev"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum