Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 660836 - =sys-devel/gdb-8.1.1: "-ftracer" and "-O3" gives Error: symbol `start_amd64_void_call_2_a' is already defined
Summary: =sys-devel/gdb-8.1.1: "-ftracer" and "-O3" gives Error: symbol `start_amd64_v...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
: 376455 (view as bug list)
Depends on:
Reported: 2018-07-10 10:05 UTC by Marcin Mirosław
Modified: 2023-08-23 01:31 UTC (History)
2 users (show)

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

build.log (build.log,747.09 KB, text/plain)
2018-07-10 20:17 UTC, Marcin Mirosław

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Mirosław 2018-07-10 10:05:11 UTC
While compiling sys-devel/gdb-8.1 with C*FLAGS="-O3 -ftracer" I got error:
x86_64-pc-linux-gnu-g++ -x c++  -O3 -ftracer -pipe    -I. -I. -I./../common -I./../regformats -I./.. -I./../../include -I./../gnulib/import -Ibuild-gnulib-gdbserver/import  -Wall -Wpointer-ari
th -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=m
aybe-uninitialized -Wformat-nonliteral  -DGDBSERVER -c -o fork-inferior.o -MT fork-inferior.o -MMD -MP -MF ./.deps/fork-inferior.Tpo ../nat/fork-inferior.c
x86_64-pc-linux-gnu-g++ -x c++  -O3 -ftracer -pipe    -I. -I. -I./../common -I./../regformats -I./.. -I./../../include -I./../gnulib/import -Ibuild-gnulib-gdbserver/import  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wformat-nonliteral  -DGDBSERVER -c -o linux-x86-low.o -MT linux-x86-low.o -MMD -MP -MF ./.deps/linux-x86-low.Tpo linux-x86-low.c
linux-x86-low.c: Assembler messages:
linux-x86-low.c:1947: Error: symbol `start_amd64_void_call_2_a' is already defined
linux-x86-low.c:1949: Error: symbol `end_amd64_void_call_2_a' is already defined
linux-x86-low.c:1953: Error: symbol `start_amd64_void_call_2_b' is already defined
linux-x86-low.c:1954: Error: symbol `end_amd64_void_call_2_b' is already defined
linux-x86-low.c:2538: Error: symbol `start_i386_int_call_1_a' is already defined
linux-x86-low.c:2540: Error: symbol `end_i386_int_call_1_a' is already defined
linux-x86-low.c:2552: Error: symbol `start_i386_int_call_1_c' is already defined
linux-x86-low.c:2555: Error: symbol `end_i386_int_call_1_c' is already defined
linux-x86-low.c:2566: Error: symbol `start_i386_void_call_2_a' is already defined
linux-x86-low.c:2571: Error: symbol `end_i386_void_call_2_a' is already defined
linux-x86-low.c:2587: Error: symbol `start_i386_void_call_2_b' is already defined
linux-x86-low.c:2590: Error: symbol `end_i386_void_call_2_b' is already defined
linux-x86-low.c:2442: Error: symbol `start_i386_reg_a' is already defined
linux-x86-low.c:2444: Error: symbol `end_i386_reg_a' is already defined
linux-x86-low.c:2451: Error: symbol `start_i386_reg_b' is already defined
linux-x86-low.c:2455: Error: symbol `end_i386_reg_b' is already defined
linux-x86-low.c:2456: Error: symbol `start_i386_reg_c' is already defined
linux-x86-low.c:2459: Error: symbol `end_i386_reg_c' is already defined
make[4]: *** [Makefile:580: linux-x86-low.o] Error 1
make[4]: Leaving directory '/var/tmp/portage/sys-devel/gdb-8.1-r1/work/gdb-8.1/gdb/gdbserver'
make[3]: *** [Makefile:2022: subdir_do] Error 1
make[3]: Leaving directory '/var/tmp/portage/sys-devel/gdb-8.1-r1/work/gdb-8.1/gdb'
make[2]: *** [Makefile:1616: all] Error 2
make[2]: Leaving directory '/var/tmp/portage/sys-devel/gdb-8.1-r1/work/gdb-8.1/gdb'
make[1]: *** [Makefile:8157: all-gdb] Error 2
make[1]: Leaving directory '/var/tmp/portage/sys-devel/gdb-8.1-r1/work/gdb-8.1'
make: *** [Makefile:850: all] Error 2

This error doesn't appear with -Os or -O2 in C*FLAGS.

Reproducible: Always

# emerge --info                                                                                                                                                 [47/1999]
Portage 2.3.40 (python 3.5.5-final-0, default/linux/amd64/17.0/no-multilib/hardened, gcc-7.3.0, glibc-2.26-r7, 4.16.0+ x86_64)
System uname: Linux-4.16.0+-x86_64-Intel-R-_Xeon-R-_CPU_X5650_@_2.67GHz-with-gentoo-2.4.1
KiB Mem:     2049752 total,    271788 free
KiB Swap:    1441784 total,    958964 free
Timestamp of repository gentoo: Mon, 09 Jul 2018 07:30:01 +0000
Head commit of repository gentoo: 65bed03677a5c293108c3b74ff062ba31957cf29
sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
ccache version 3.3.4 [enabled]
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.24.3-r1::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.5.5::gentoo
dev-util/ccache:          3.3.4-r1::gentoo
dev-util/cmake:           3.9.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.34.11::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.69-r4::gentoo
sys-devel/automake:       1.15.1-r2::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo, 2.30-r2::gentoo
sys-devel/gcc:            7.3.0-r3::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r7::gentoo

    location: /mnt/bcache/slash/usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: no
    sync-rsync-verify-max-age: 24

Installed sets: @fail2ban, @www                                                                                                                                                         [1/1999]
CFLAGS="-O3 -ggdb -march=westmere -mtune=native -ftracer -fuse-ld=gold -fvar-tracking-assignments -fopt-info-optimized -pipe"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.1/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cli-php7.1/ext-active/ /et
c/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -ggdb -march=westmere -mtune=native -ftracer -fuse-ld=gold -fvar-tracking-assignments -fopt-info-optimized -pipe"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache collision-protect compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch parallel
-install preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2 -l 3"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exc
lude=/local --exclude=/packages --exclude=/.git"
USE="acl amd64 bzip2 caps crypt cxx device-mapper hardened iconv idn iproute2 ipv6 jemalloc libtirpc lto modules nano-syntax ncurses nls nptl openmp pam pcre pgo pie readline seccomp sse sse2
sse3 sse4_1 sse4_2 ssl ssp ssse3 udev unicode xattr xtpax zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hd
a-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon a
uthn_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=
"karbon plan sheets stage words" COLLECTD_PLUGINS="aggregation cgroups conntrack contextswitch cpu curl curl_json df disk dns email entropy ethstat exec filecount hugepages interface iptables
irq lvm match_regex mysql netlink load memory network nginx notify_email ntpd openvpn ping postgresql processes protocols redis snmp statsd swap syslog tail tail_csv tcpconns unixsock uptime v
mem" CPU_FLAGS_X86="aes sse sse2 sse3 ssse3 sse4_1 sse4_2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom o
ceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" L10N="en p
l" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NGINX_MODULES_HTTP="access auth_basic brow
ser charset dav dav_ext fastcgi gzip headers_more limit_conn limit_req map proxy realip referer rewrite security" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-1" POSTGRES_TARGETS="pos
tgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dum
my v4l" XTABLES_ADDONS="tarpit"
Comment 1 Jonas Stein gentoo-dev 2018-07-10 20:07:05 UTC
Thank you for the report. Please recompile and *attach* the logfiles as described on
Please reopen this ticket (Status:unconfirmed) afterwards.
Comment 2 Marcin Mirosław 2018-07-10 20:17:54 UTC
Created attachment 539082 [details]
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2018-07-10 21:05:08 UTC
-ftracer is incompatible with some of inline assembly that defines labels as -ftracer duplicates statements as-is.

Simplest workaround would be to add 'strip-flags -ftracer' to gdb ebuild.
Being a workaround it will not help -fprofile-use users.

I wonder if there is a cheap way to make assembly more duplication-friendly or forbid duplication entirely (like marking asm statement volatile).
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2018-08-07 21:25:51 UTC
(In reply to Sergei Trofimovich from comment #3)
> -ftracer is incompatible with some of inline assembly that defines labels as
> -ftracer duplicates statements as-is.
> Simplest workaround would be to add 'strip-flags -ftracer' to gdb ebuild.
> Being a workaround it will not help -fprofile-use users.
> I wonder if there is a cheap way to make assembly more duplication-friendly
> or forbid duplication entirely (like marking asm statement volatile).

Found it. Duplication cases are explicitly listed in

Under certain circumstances, GCC may duplicate (or remove duplicates of) your assembly code when optimizing. This can lead to unexpected duplicate symbol errors during compilation if your asm code defines symbols or labels. Using ‘%=’ (see AssemblerTemplate) may help resolve this problem. 


    Outputs a number that is unique to each instance of the asm statement in the entire compilation. This option is useful when creating local labels and referring to them multiple times in a single template that generates multiple assembler instructions.

Unfortunately gdb wants to define labels explicitly and refer them from C code in EMIT_ASM and EMIT_ASM32 macros. I think it would make sense to move label definition out into a top-level definition.
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2019-01-27 11:25:16 UTC
*** Bug 376455 has been marked as a duplicate of this bug. ***