Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 615748 - =dev-build/libtool-2.4.6-r6: libtool strips LDFLAGS/CFLAGS for "--param<space>option" style flags
Summary: =dev-build/libtool-2.4.6-r6: libtool strips LDFLAGS/CFLAGS for "--param<space...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: cflags ldflags
  Show dependency tree
 
Reported: 2017-04-16 10:43 UTC by Marco Ziebell
Modified: 2024-01-15 16:40 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log of =dev-libs/libffi-3.2.1 (build.log,36.54 KB, text/x-log)
2017-04-16 10:43 UTC, Marco Ziebell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Ziebell 2017-04-16 10:43:50 UTC
Created attachment 470114 [details]
build log of =dev-libs/libffi-3.2.1

During the linking-phase of libffi the LDFLAGS are stripped.
e.g with CFLAGS and LDFLAGS like
CFLAGS="-march=native -mtune=native -w -pthread -pipe -fPIC -fdata-sections -ffunction-sections -g0 -O2 -flto=2 -fuse-linker-plugin -flto-partition=none -fomit-frame-pointer -ftree-vectorize -fira-loop-pressure -fno-aggressive-loop-optimizations -funswitch-loops -fgcse-sm -fgcse-las -fgcse-after-reload -fopenmp-simd -fopenmp -ftree-partial-pre -finline-functions -funroll-loops -mvzeroupper -malign-data=cacheline -maccumulate-outgoing-args -fschedule-insns -fsched-pressure -fmodulo-sched -fmodulo-sched-allow-regmoves --param prefetch-latency=600"

LDFLAGS="-Wl,-O1,--icf=all,--icf-iterations=4,--gc-sections,--as-needed,--hash-style=gnu ${CFLAGS}"

the resulting command invocation looks like this. please see the incorrect "--param".
-march=native -mtune=native -pthread -O2 -flto=2 -fuse-linker-plugin -flto-partition=none -fopenmp -mvzeroupper -malign-data=cacheline -maccumulate-outgoing-args -Wl,-O1 -Wl,--icf=all -Wl,--icf-iterations=4 -Wl,--gc-sections -Wl,--as-needed -Wl,--hash-style=gnu  -march=native -mtune=native -pthread -fPIC -fdata-sections -ffunction-sections -O2 -flto=2 -fuse-linker-plugin -flto-partition=none -fomit-frame-pointer -ftree-vectorize -fira-loop-pressure -fno-aggressive-loop-optimizations -funswitch-loops -fgcse-sm -fgcse-las -fgcse-after-reload -fopenmp-simd -fopenmp -ftree-partial-pre -finline-functions -funroll-loops -mvzeroupper -malign-data=cacheline -maccumulate-outgoing-args -fschedule-insns -fsched-pressure -fmodulo-sched --param -fmodulo-sched-allow-regmoves -fuse-ld=gold -Wl,-O1 -Wl,--icf=all -Wl,--icf-iterations=4 -Wl,--gc-sections -Wl,--as-needed -Wl,--hash-style=gnu -march=native -mtune=native -pthread -O2 -flto=2 -fuse-linker-plugin -flto-partition=none -fopenmp -mvzeroupper -malign-data=cacheline -maccumulate-outgoing-args   -pthread -fopenmp -Wl,-soname -Wl,libffi.so.6 -o .libs/libffi.so.6.0.4


The combination of CFLAGS and LDFLAGS is needed for LTO. Even though LTO is not officially supported (my last information), incorrect stripping is always bad.
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-29 12:15:55 UTC
libtool performs parameter reordering to accomodate toolchain deficiencies: reorder libraries, sort CFLAGS, objects, libraries and so on.


Unfortunatly that means it has to understand multi-arguments flags like

    CFLAGS="... --param prefetch-latency=600 ..."

libtool does not understand them. The workaround is to use single-argument form:

    CFLAGS="... --param=prefetch-latency=600 ..."
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-29 12:26:43 UTC
Running 'elibtoolize' produces the same broken behaviour. Reassigning to base-system@ to triage further and maybe ask upstream to enhance option parsing.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-29 13:59:58 UTC
Here is a libtool's flag whitelist:
    https://git.savannah.gnu.org/cgit/libtool.git/tree/build-aux/ltmain.in#n5365