This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds


When building trunk on a Ubuntu 16.10 ppc64le system, I see the
following linker error building gdb:

ppc-linux.o: In function `ppc64_64bit_inferior_p(long)':
ppc-linux.c:(.text+0x7c): undefined reference to `.LCTOC0'
common-debug.o: In function `debug_printf(char const*, ...)':
common-debug.c:(.text+0x20): undefined reference to `.LCTOC0'
continuations.o: In function `do_my_continuations(continuation**, int)':
continuations.c:(.text+0x1bc): undefined reference to `.LCTOC0'
errors.o: In function `warning(char const*, ...)':
errors.c:(.text+0x20): undefined reference to `.LCTOC0'
errors.o: In function `error(char const*, ...)':
errors.c:(.text+0xd4): undefined reference to `.LCTOC0'
errors.o:errors.c:(.text+0x14c): more undefined references to `.LCTOC0' follow
collect2: error: ld returned 1 exit status
Makefile:2222: recipe for target 'gdb' failed
make[2]: *** [gdb] Error 1
make[2]: Leaving directory '/home/bergner/binutils/build/binutils-mcmodel/gdb'
Makefile:10420: recipe for target 'all-gdb' failed
make[1]: *** [all-gdb] Error 2
make[1]: Leaving directory '/home/bergner/binutils/build/binutils-mcmodel'
Makefile:849: recipe for target 'all' failed
make: *** [all] Error 2

This is caused by a since fixed gcc bug when using -mminimal-toc.
The -mminimal-toc option is only used with the small code model,
which is all the powerpc64-linux used to have, but with Alan's
long ago patch that added -mcmodel={small,medium,large} and medium
code model being the default, we don't need to use -mminimal-toc
anymore.

The following patch replaces -mminimal-toc with -mcmodel=medium.
This allows trunk to build again, but also catches people using
ancient gcc's and leaves them a comment in the source on how to
work around their build problem.

Ok for trunk?

Peter

	* config/powerpc/ppc64-linux.mh (MH_FLAGS): Use -mcmodel=medium.



diff --git a/gdb/config/powerpc/ppc64-linux.mh b/gdb/config/powerpc/ppc64-linux.mh
index 580eb1f..a0b3252 100644
--- a/gdb/config/powerpc/ppc64-linux.mh
+++ b/gdb/config/powerpc/ppc64-linux.mh
@@ -10,11 +10,13 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
        linux-namespaces.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
-# The PowerPC has severe limitations on TOC size, and uses them even
-# for non-PIC code.  GDB overflows those tables when compiling with
-# -mfull-toc (the default), so we need to ask GCC to use as few TOC
-# entries as possible.
-MH_CFLAGS= -mminimal-toc
+# With the addition of -mcmodel={small,medium,large} (default=medium),
+# PowerPC no longer has a problem with TOC size, so we no longer need
+# to ask GCC to use as few TOC entries as possible.
+# We explicitly use the -mcmodel=medium option to catch users of older
+# compilers.  They can work around their build failure by reverting back
+# to using the -mminimal-toc option.
+MH_CFLAGS= -mcmodel=medium
 
 # The dynamically loaded libthread_db needs access to symbols in the
 # gdb executable.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]