public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds
@ 2017-03-02 19:14 Peter Bergner
  2017-03-06  0:17 ` Alan Modra
  2017-03-07  8:14 ` Ulrich Weigand
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Bergner @ 2017-03-02 19:14 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ulrich Weigand, Alan Modra

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds
  2017-03-02 19:14 [PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds Peter Bergner
@ 2017-03-06  0:17 ` Alan Modra
  2017-03-07  8:14 ` Ulrich Weigand
  1 sibling, 0 replies; 6+ messages in thread
From: Alan Modra @ 2017-03-06  0:17 UTC (permalink / raw)
  To: Peter Bergner; +Cc: gdb-patches, Ulrich Weigand

On Thu, Mar 02, 2017 at 01:14:32PM -0600, Peter Bergner wrote:
> 	* config/powerpc/ppc64-linux.mh (MH_FLAGS): Use -mcmodel=medium.

Looks good to me.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds
  2017-03-02 19:14 [PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds Peter Bergner
  2017-03-06  0:17 ` Alan Modra
@ 2017-03-07  8:14 ` Ulrich Weigand
  2017-03-07 12:20   ` Peter Bergner
  1 sibling, 1 reply; 6+ messages in thread
From: Ulrich Weigand @ 2017-03-07  8:14 UTC (permalink / raw)
  To: Peter Bergner; +Cc: gdb-patches, Alan Modra

Peter Bergner wrote:

> 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?

Given that GDB now requires a C++11 compiler to build anyway,
and as far as I can see, all versions of GCC that support C++11
already support (and default to) the medium memory model, can
we simply remove the MH_CFLAGS setting instead?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds
  2017-03-07  8:14 ` Ulrich Weigand
@ 2017-03-07 12:20   ` Peter Bergner
  2017-03-07 13:46     ` Ulrich Weigand
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Bergner @ 2017-03-07 12:20 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches, Alan Modra

On 3/7/17 2:14 AM, Ulrich Weigand wrote:
> Peter Bergner wrote:
> Given that GDB now requires a C++11 compiler to build anyway,
> and as far as I can see, all versions of GCC that support C++11
> already support (and default to) the medium memory model, can
> we simply remove the MH_CFLAGS setting instead?

I'm fine with removing the flag and comment.  Is that preapproved?

Peter



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds
  2017-03-07 12:20   ` Peter Bergner
@ 2017-03-07 13:46     ` Ulrich Weigand
  2017-03-07 15:51       ` Peter Bergner
  0 siblings, 1 reply; 6+ messages in thread
From: Ulrich Weigand @ 2017-03-07 13:46 UTC (permalink / raw)
  To: Peter Bergner; +Cc: gdb-patches, Alan Modra

Peter Bergner wrote:
> On 3/7/17 2:14 AM, Ulrich Weigand wrote:
> > Given that GDB now requires a C++11 compiler to build anyway,
> > and as far as I can see, all versions of GCC that support C++11
> > already support (and default to) the medium memory model, can
> > we simply remove the MH_CFLAGS setting instead?
> 
> I'm fine with removing the flag and comment.  Is that preapproved?

Yes, this is OK.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds
  2017-03-07 13:46     ` Ulrich Weigand
@ 2017-03-07 15:51       ` Peter Bergner
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Bergner @ 2017-03-07 15:51 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches, Alan Modra

On 3/7/17 7:45 AM, Ulrich Weigand wrote:
> Peter Bergner wrote:
>> On 3/7/17 2:14 AM, Ulrich Weigand wrote:
>>> Given that GDB now requires a C++11 compiler to build anyway,
>>> and as far as I can see, all versions of GCC that support C++11
>>> already support (and default to) the medium memory model, can
>>> we simply remove the MH_CFLAGS setting instead?
>>
>> I'm fine with removing the flag and comment.  Is that preapproved?
> 
> Yes, this is OK.

Ok, I committed:

    Remove use of the no longer needed -mminimal-toc option.

            * config/powerpc/ppc64-linux.mh (MH_CFLAGS): Delete.

Thanks.

Peter


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-07 15:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02 19:14 [PATCH] Remove use of -mminimal-toc from powerpc64*-linux builds Peter Bergner
2017-03-06  0:17 ` Alan Modra
2017-03-07  8:14 ` Ulrich Weigand
2017-03-07 12:20   ` Peter Bergner
2017-03-07 13:46     ` Ulrich Weigand
2017-03-07 15:51       ` Peter Bergner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).