Bug 1383075

Summary: -fstack-protector-strong: undefined reference to `.LCTOC0'
Product: Red Hat Developer Toolset Reporter: Jan Kratochvil <jan.kratochvil>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Michael Petlan <mpetlan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: DTS 7.0 RHEL 7CC: jan.kratochvil, kanderso, law, mcermak, mnewsome, mpetlan, mpolacek, ohudlick
Target Milestone: alpha   
Target Release: 6.0   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: devtoolset-6-gcc-6.3.1-2.2.el7 Doc Type: Bug Fix
Doc Text:
Due to a bug in the rs6000 backend, where a TOC ("Table of Contents") was not correctly initialized, a valid program might have failed to link if the -fstack-protector-strong and -mminimal-toc command-line options were used. The bug has been fixed and the program now links.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-26 09:32:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jan Kratochvil 2016-10-09 15:51:38 UTC
Description of problem:
Building GDB with custom flags fails with $subj error message.

Version-Release number of selected component (if applicable):
FAIL: devtoolset-6-gcc-6.2.1-2.el7.ppc64le
PASS: gcc-4.8.5-11.el7.ppc64le
43b831cb453921462b3a296e9796837cd71c1cde binutils-gdb.git

How reproducible:
Always.

Steps to Reproduce:
git clone git://sourceware.org/git/binutils-gdb.git;cd binutils-gdb;git checkout 43b831cb453921462b3a296e9796837cd71c1cde
CXXFLAGS=-fstack-protector-strong ./configure;make
or
CFLAGS=-fstack-protector-strong CXXFLAGS=-fstack-protector-strong LDFLAGS=-fstack-protector-strong ./configure;make

Actual results:
...
g++ -fstack-protector-strong -mminimal-toc  -static-libstdc++ -static-libgcc -fstack-protector-strong   \
        -o gdb gdb.o [...]
ppc-linux.o: In function `ppc64_64bit_inferior_p(long)':
ppc-linux.c:(.text+0x7c): undefined reference to `.LCTOC0'
continuations.o: In function `do_my_continuations(continuation**, int)':
continuations.c:(.text+0x1bc): undefined reference to `.LCTOC0'
namespace.o: In function `add_using_directive(using_direct**, char const*, char const*, char const*, char const*, VEC_const_char_ptr*, int, obstack*)':
namespace.c:(.text+0x148): undefined reference to `.LCTOC0' 
gdb_obstack.o: In function `obconcat(obstack*, ...)':
gdb_obstack.c:(.text+0x20): undefined reference to `.LCTOC0'
gdb_obstack.o: In function `obstack_strdup(obstack*, char const*)': 
gdb_obstack.c:(.text+0x2c0): undefined reference to `.LCTOC0'
trad-frame.o:trad-frame.c:(.text+0xa0): more undefined references to `.LCTOC0' follow 
collect2: error: ld returned 1 exit status
Makefile:1421: recipe for target 'gdb' failed

Expected results:
Built GDB.

Additional info:
43b831cb453921462b3a296e9796837cd71c1cde is just current binutils-gdb.git trunk hash.

https://beaker.engineering.redhat.com/recipes/3150927
 = RHEL-7.3-20161007.n.0 Server ppc64le

Sure it is not a blocker for me, it just failed to build for me with my normal custom flags.

Comment 6 Michael Petlan 2017-02-15 14:21:59 UTC
Reproduced with devtoolset-6-gcc-6.2.1-3.1.el7
Verified with   devtoolset-6-gcc-6.3.1-2.2.el7

VERIFIED

Comment 8 errata-xmlrpc 2017-04-26 09:32:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1143