Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 620402 - dev-util/valgrind-3.12.0 build fails with vg_preloaded.c:124: undefined reference to `__stack_chk_fail_local'
Summary: dev-util/valgrind-3.12.0 build fails with vg_preloaded.c:124: undefined refer...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-02 06:48 UTC by Zoltan Puskas
Modified: 2017-12-12 22:01 UTC (History)
2 users (show)

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


Attachments
build.log (build.log,435.29 KB, text/x-log)
2017-06-02 06:48 UTC, Zoltan Puskas
Details
proposed patch (0001-dev-util-valgrind-filter-out-more-fstack-protector-C.patch,4.09 KB, patch)
2017-12-04 22:49 UTC, Austin English (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zoltan Puskas 2017-06-02 06:48:56 UTC
Created attachment 474964 [details]
build.log

Since upgrading to GCC 6.3 Valgrind will not compile.

# emerge --info '=dev-util/valgrind-3.12.0::gentoo'
Portage 2.3.6 (python 3.4.6-final-0, default/linux/amd64/13.0/desktop/plasma, gcc-6.3.0, glibc-2.24-r1, 4.11.3-gentoo x86_64)                                                                                                                                                     
=================================================================                                                                                                                                                                                                                 
                         System Settings                                                                                                                                                                                                                                          
=================================================================                                                                                                                                                                                                                 
System uname: Linux-4.11.3-gentoo-x86_64-Intel-R-_Core-TM-_i5-3230M_CPU_@_2.60GHz-with-gentoo-2.3                                                                                                                                                                                 
KiB Mem:    16316524 total,   1763064 free                                                                                                                                                                                                                                        
KiB Swap:    2096124 total,   2096124 free                                                                                                                                                                                                                                        
Timestamp of repository gentoo: Thu, 01 Jun 2017 05:30:01 +0000                                                                                                                                                                                                                   
sh bash 4.4_p12                                                                                                                                                                                                                                                                   
ld GNU ld (Gentoo 2.27 p1.0) 2.27                                                                                                                                                                                                                                                 
distcc 3.2rc1 x86_64-pc-linux-gnu [enabled]                                                                                                                                                                                                                                       
app-shells/bash:          4.4_p12::gentoo                                                                                                                                                                                                                                         
dev-java/java-config:     2.2.0-r3::gentoo                                                                                                                                                                                                                                        
dev-lang/perl:            5.24.1-r1::gentoo                                                                                                                                                                                                                                       
dev-lang/python:          2.7.13::gentoo, 3.4.6::gentoo                                                                                                                                                                                                                           
dev-util/cmake:           3.8.1::gentoo                                                                                                                                                                                                                                           
dev-util/pkgconfig:       0.29.2::gentoo                                                                                                                                                                                                                                          
sys-apps/baselayout:      2.3::gentoo                                                                                                                                                                                                                                             
sys-apps/openrc:          0.26.3::gentoo                                                                                                                                                                                                                                          
sys-apps/sandbox:         2.10-r4::gentoo                                                                                                                                                                                                                                         
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo                                                                                                                                                                                                                           
sys-devel/automake:       1.13.4-r1::gentoo, 1.15-r2::gentoo                                                                                                                                                                                                                      
sys-devel/binutils:       2.27::gentoo                                                                                                                                                                                                                                            
sys-devel/gcc:            6.3.0::gentoo                                                                                                                                                                                                                                           
sys-devel/gcc-config:     1.8-r1::gentoo                                                                                                                                                                                                                                          
sys-devel/libtool:        2.4.6-r4::gentoo                                                                                                                                                                                                                                        
sys-devel/make:           4.2.1-r1::gentoo                                                                                                                                                                                                                                        
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)                                                                                                                                                                                                                       
sys-libs/glibc:           2.24-r1::gentoo                                                                                                                                                                                                                                         
Repositories:                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                  
gentoo                                                                                                                                                                                                                                                                            
    location: /usr/portage                                                                                                                                                                                                                                                        
    sync-type: rsync                                                                                                                                                                                                                                                              
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage                                                                                                                                                                                                                             
    priority: -1000

local-dev
    location: /usr/local/portage
    masters: gentoo

java
    location: /var/lib/layman/java
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/java.git
    masters: gentoo
    priority: 50

mrueg
    location: /var/lib/layman/mrueg
    sync-type: laymansync
    sync-uri: https://anongit.gentoo.org/git/dev/mrueg.git
    masters: gentoo
    priority: 50

proaudio
    location: /var/lib/layman/proaudio
    sync-type: laymansync
    sync-uri: svn://svn.tuxfamily.org/svnroot/proaudio/proaudio/trunk/overlays/proaudio
    masters: gentoo
    priority: 50

sinustrom
    location: /var/lib/layman/sinustrom
    sync-type: laymansync
    sync-uri: https://github.com/zpuskas/sinustrom-gentoo-overlay.git
    masters: gentoo
    priority: 50

vaca
    location: /var/lib/layman/vaca
    sync-type: laymansync
    sync-uri: git://github.com/hashashin/gentoo-vaca-overlay.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=ivybridge -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -maes -mpclmul -mpopcnt -mavx -msse4.2 -msse4.1 -mrdrnd -mf16c -mfsgsbase -mfxsr -mxsave -mxsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=3072 -mtune=ivybridge -fstack-protector-strong -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=ivybridge -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -maes -mpclmul -mpopcnt -mavx -msse4.2 -msse4.1 -mrdrnd -mf16c -mfsgsbase -mfxsr -mxsave -mxsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=3072 -mtune=ivybridge -fstack-protector-strong -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distcc distcc-pump distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/"
LANG="en_IE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j20 -l4"
PKGDIR="/usr/portage/packages"
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="/tmp"
USE="X a52 aac acl acpi aes alsa amd64 avx bash-completion berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus declarative dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif glamor gphoto2 gpm gtk hardened iconv ipv6 jpeg jpeg2k kde kipi kwallet lcms ldap libnotify lm_sensors lzma mad mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses networkmanager nls nptl ogg opengl openmp pam pango pcre pdf phonon plasma png policykit popcnt posix ppds qml qt3support qt4 qt5 readline sdl seccomp session smp spell sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 startup-notification svg tcpd threads tiff truetype udev udisks unicode upower usb uxa vaapi vim-syntax vorbis widgets wifi wxwidgets x264 xattr xcb xcomposite xinerama xml xpm xscreensaver xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="hda-intel usb-audio" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev wacom synaptics joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LIRC_DEVICES="alsa_usb" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="x86_64 arm" QEMU_USER_TARGETS="x86_64 arm" RUBY_TARGETS="ruby21 ruby22 ruby23 ruby24" SANE_BACKENDS="plustek" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

dev-util/valgrind-3.12.0::gentoo was built with the following:
USE="-mpi" ABI_X86="(64)"
CFLAGS="-march=ivybridge -maes -mavx -mcx16 -mf16c -mfsgsbase -mfxsr -mmmx -mpclmul -mpopcnt -mrdrnd -msahf -msse -msse3 -msse3 -msse4 -msse4.1 -msse4.2 -mssse3 -mtune=ivybridge -mxsave -mxsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=3072 -O2 -pipe -fno-stack-protector"
CXXFLAGS="-march=ivybridge -maes -mavx -mcx16 -mf16c -mfsgsbase -mfxsr -mmmx -mpclmul -mpopcnt -mrdrnd -msahf -msse -msse3 -msse3 -msse4 -msse4.1 -msse4.2 -mssse3 -mtune=ivybridge -mxsave -mxsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=3072 -O2 -pipe -fno-stack-protector"
Comment 1 slawan 2017-06-18 13:47:07 UTC
remove -fstack-protector-strong from CFLAGS
Comment 2 slawan 2017-06-18 13:58:59 UTC
also remove -fno-stack-protector from CFLAGS... 

part of my info:
=================================================================
                        Package Settings
=================================================================

dev-util/valgrind-3.13.0::gentoo was built with the following:
USE="-mpi" ABI_X86="(64)"
CFLAGS="-O2 -march=native -mtune=native -pipe"
CXXFLAGS="-O2 -march=native -mtune=native -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
Comment 3 Anthony Basile gentoo-dev 2017-06-19 00:04:51 UTC
comment #1 makes sense.  comment #2 doesn't.  are you sure you want to *remove* -fno-stack-protector?
Comment 4 Zoltan Puskas 2017-06-24 18:32:33 UTC
By removing only -fstack-protector-strong valgrind compiles. Two questions:
1) Why is this?
2) Can the ebuild maybe check for this flag and warn user? Better, remove this flag if the user has it set?
Comment 5 Austin English (RETIRED) gentoo-dev 2017-08-15 18:05:34 UTC
(In reply to Zoltan Puskas from comment #4)
> By removing only -fstack-protector-strong valgrind compiles. Two questions:
> 1) Why is this?

Probably a gcc bug, as I'm not able to reproduce this with gcc-5.4.0 or 6.4.0, with either 3.12.0 or 3.13.0

> 2) Can the ebuild maybe check for this flag and warn user? Better, remove
> this flag if the user has it set?

That's doable in an ebuild. Upstream tries to force no-stack-protector, so it makes sense:
https://sourceware.org/git/?p=valgrind.git;a=commitdiff;h=ecc35db60bde00d624986a5aaf5271f0de4bae30
https://bugs.kde.org/show_bug.cgi?id=144112

I'm curious how you're seeing this. I tried using your CFLAGS/CXXFLAGS in a chroot, and I clearly see -fstack-protector getting passed, but the latter -fno-stack-protector later overrides it:
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../include -I../VEX/pub -I../VEX/pub -DVGA_amd64=1 -DVGO_linux=1 -DVGP_amd64_linux=1 -DVGPV_amd64_linux_vanilla=1  -m64 -fno-stack-protector -O2 -g -std=gnu99 -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wold-style-declaration -fno-stack-protector -fno-strict-aliasing -fno-builtin  -fomit-frame-pointer -O2 -march=ivybridge -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -maes -mpclmul -mpopcnt -mavx -msse4.2 -msse4.1 -mrdrnd -mf16c -mfsgsbase -mfxsr -mxsave -mxsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=3072 -mtune=ivybridge -fstack-protector-strong -O2 -pipe -fno-stack-protector -c -o helgrind_amd64_linux-hg_addrdescr.o `test -f 'hg_addrdescr.c' || echo './'`hg_addrdescr.c

The ebuild already filters this out as well, see bug 114347:
filter-flags -fstack-protector

something weird is going on. If I comment out that line, I see the same failure you do. That change has been in Gentoo since the git transition, so you certainly have that in your ebuild.

I'm at a loss.
Comment 6 N Tee 2017-12-04 08:59:37 UTC
Thanks for the hint. The following patch helped:

# diff /usr/portage/dev-util/valgrind/valgrind-3.12.0.ebuild /usr/portage/dev-util/valgrind/valgrind-3.12.0-r1.ebuild
52a53
> 	filter-flags -fstack-protector-strong
#
Comment 7 Austin English (RETIRED) gentoo-dev 2017-12-04 22:49:44 UTC
Created attachment 508196 [details, diff]
proposed patch

This is the fix I intend to commit for this, assuming @blueness is okay with it.
Comment 8 Austin English (RETIRED) gentoo-dev 2017-12-12 22:01:00 UTC
(In reply to Austin English from comment #7)
> Created attachment 508196 [details, diff] [details, diff]
> proposed patch
> 
> This is the fix I intend to commit for this, assuming @blueness is okay with
> it.

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=625541b28d782f5f55a13427424a7eb2b9e7ebf3