public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Mainline and branch: --enable-targets=all dead on cygwin
@ 2006-04-19 16:27 Dave Korn
  2006-04-26 11:31 ` Nick Clifton
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Korn @ 2006-04-19 16:27 UTC (permalink / raw)
  To: binutils


    Hi all,

  Configuring binutils with --enable-targets=all fails when building gas at
obj-coff.o:

gcc -DHAVE_CONFIG_H -I. -I/gnu/binutils/binutils-2.16.92/gas -I. -D_GNU_SOURCE
-
I. -I/gnu/binutils/binutils-2.16.92/gas -I../bfd
-I/gnu/binutils/binutils-2.16.9
2/gas/config -I/gnu/binutils/binutils-2.16.92/gas/../include
-I/gnu/binutils/bin
utils-2.16.92/gas/.. -I/gnu/binutils/binutils-2.16.92/gas/../bfd
-I/gnu/binutils
/binutils-2.16.92/gas/../intl -I../intl
-DLOCALEDIR="\"/usr/build/install/share/
locale\""   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2
-c
/gnu/binutils/binutils-2.16.92/gas/config/obj-coff.c
In file included from
/gnu/binutils/binutils-2.16.92/gas/config/obj-multi.h:26,
                 from ./obj-format.h:1,
                 from /gnu/binutils/binutils-2.16.92/gas/config/te-pe.h:7,
                 from ./targ-env.h:1,
                 from /gnu/binutils/binutils-2.16.92/gas/as.h:585,
                 from /gnu/binutils/binutils-2.16.92/gas/config/obj-coff.c:25:
/gnu/binutils/binutils-2.16.92/gas/config/obj-coff.h:63:1: "TARGET_FORMAT"
redefined
In file included from ./targ-cpu.h:1,
                 from /gnu/binutils/binutils-2.16.92/gas/config/obj-coff.h:28,
                 from
/gnu/binutils/binutils-2.16.92/gas/config/obj-multi.h:26,
                 from ./obj-format.h:1,
                 from /gnu/binutils/binutils-2.16.92/gas/config/te-pe.h:7,
                 from ./targ-env.h:1,
                 from /gnu/binutils/binutils-2.16.92/gas/as.h:585,
                 from /gnu/binutils/binutils-2.16.92/gas/config/obj-coff.c:25:
/gnu/binutils/binutils-2.16.92/gas/config/tc-i386.h:69:1: this is the location
of the previous definition
make[4]: *** [obj-coff.o] Error 1


  Both obj-coff.h and tc-i386.h seem to believe they 'own' TARGET_FORMAT.

/gnu/binutils/binutils-2.16.92/gas/config/obj-coff.h
    59  #ifdef TC_I386
    60  #include "coff/i386.h"
    61
    62  #ifdef TE_PE
    63  #define TARGET_FORMAT "pe-i386"
    64  #endif
    65
    66  #ifndef TARGET_FORMAT
    67  #define TARGET_FORMAT "coff-i386"
    68  #endif
    69  #endif


/gnu/binutils/binutils-2.16.92/gas/config/tc-i386.h

    66  #if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \
    67       || defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF))
    68  extern const char *i386_target_format PARAMS ((void));
    69  #define TARGET_FORMAT i386_target_format ()
    70  #else
    71  #ifdef OBJ_ELF
    72  #define TARGET_FORMAT           ELF_TARGET_FORMAT
    73  #endif
    74  #ifdef OBJ_AOUT
    75  #define TARGET_FORMAT           AOUT_TARGET_FORMAT
    76  #endif
    77  #endif


  Ummm.  The next thing I tried was to move that #ifdef TE_PE inside the
#ifndef TARGET_FORMAT, like so:

    59  #ifdef TC_I386
    60  #include "coff/i386.h"
    61
    62  #ifndef TARGET_FORMAT
    63  #ifdef TE_PE
    64  #define TARGET_FORMAT "pe-i386"
    65  #else
    66  #define TARGET_FORMAT "coff-i386"
    67  #endif
    68  #endif
    69  #endif

and now all I get is

mkdir .libs
gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -o
as-new.e
xe app.o as.o atof-generic.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o
eho
pt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o
input-file
.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o
sb.
o stabs.o subsegs.o symbols.o write.o tc-i386.o obj-multi.o atof-ieee.o
obj-coff
.o obj-aout.o obj-elf.o e-i386coff.o e-i386aout.o e-i386elf.o
../bfd/.libs/libb
fd.a ../libiberty/libiberty.a ./../intl/libintl.a
obj-coff.o: In function `coff_frob_symbol':
/gnu/binutils/binutils-2.16.92/gas/config/obj-coff.c:1055: undefined reference
t
o `_an_external_name'
collect2: ld returned 1 exit status
make[4]: *** [as-new.exe] Error 1
make[4]: Leaving directory `/repository/davek/patch-gnu/binutils/obj-all/gas'

because of this:

  1054  #ifdef USE_UNIQUE
  1055    if (an_external_name != NULL)
  1056      unique = an_external_name;
  1057  #endif

where 'an_external_name' should exist in symbols.c:

    62  #ifdef USE_UNIQUE
    63  /* The name of an external symbol which is
    64     used to make weak PE symbol names unique.  */
    65  const char * an_external_name;
    66  #endif

but doesn't.  It is defined in obj-coff.h under #ifdef TE_PE, but symbols.c
doesn't include obj-coff.h in this arrangement, because obj-coff.h is included
from obj-multi.h:

    25  #ifdef OBJ_HEADER
    26  #include OBJ_HEADER
    27  #else

and OBJ_HEADER is only defined in the obj-*.c files and not in symbols.c.

  Could anyone who knows better than me where the responsibility for setting
TARGET_FORMAT truly lies and what's the difference between a TC_xxxx and a
TE_xxxxx please comment on this clash?  I don't yet get it myself. :-(


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

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

* Re: Mainline and branch: --enable-targets=all dead on cygwin
  2006-04-19 16:27 Mainline and branch: --enable-targets=all dead on cygwin Dave Korn
@ 2006-04-26 11:31 ` Nick Clifton
  2006-04-26 12:47   ` Dave Korn
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2006-04-26 11:31 UTC (permalink / raw)
  To: Dave Korn; +Cc: binutils

Hi Dave,

>   Configuring binutils with --enable-targets=all fails when building gas at
> obj-coff.o:
> 
> gcc -DHAVE_CONFIG_H -I. -I/gnu/binutils/binutils-2.16.92/gas -I. -D_GNU_SOURCE

> /gnu/binutils/binutils-2.16.92/gas/config/obj-coff.h:63:1: "TARGET_FORMAT"
> redefined

Is this still a problem ?  I tried to reproduce it locally and could 
not.  Ie the enable-targets=all build completed successfully.

Cheers
   Nick


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

* RE: Mainline and branch: --enable-targets=all dead on cygwin
  2006-04-26 11:31 ` Nick Clifton
@ 2006-04-26 12:47   ` Dave Korn
  2006-04-26 14:38     ` Alan Modra
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Korn @ 2006-04-26 12:47 UTC (permalink / raw)
  To: 'Nick Clifton'; +Cc: binutils

On 26 April 2006 10:30, Nick Clifton wrote:

> Hi Dave,
> 
>>   Configuring binutils with --enable-targets=all fails when building gas
>> at obj-coff.o: 
>> 
>> gcc -DHAVE_CONFIG_H -I. -I/gnu/binutils/binutils-2.16.92/gas -I.
>> -D_GNU_SOURCE 
> 
>> /gnu/binutils/binutils-2.16.92/gas/config/obj-coff.h:63:1: "TARGET_FORMAT"
>> redefined
> 
> Is this still a problem ?  I tried to reproduce it locally and could
> not.  Ie the enable-targets=all build completed successfully.
> 
> Cheers
>    Nick

  I just filed a PR as it was still happening to me last night.  Maybe
something in my cygwin installation isn't fully up-to-date; I'll make sure
I've got the latest everything and double-check.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

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

* Re: Mainline and branch: --enable-targets=all dead on cygwin
  2006-04-26 12:47   ` Dave Korn
@ 2006-04-26 14:38     ` Alan Modra
  2006-04-26 16:59       ` Dave Korn
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Modra @ 2006-04-26 14:38 UTC (permalink / raw)
  To: Dave Korn; +Cc: 'Nick Clifton', binutils

On Wed, Apr 26, 2006 at 10:41:08AM +0100, Dave Korn wrote:
>   I just filed a PR as it was still happening to me last night.  Maybe
> something in my cygwin installation isn't fully up-to-date; I'll make sure
> I've got the latest everything and double-check.

It's a bug.  Try this.

	* config/obj-coff.h (TARGET_FORMAT <TC_I386>): Wrap all with #ifndef.

Index: gas/config/obj-coff.h
===================================================================
RCS file: /cvs/src/src/gas/config/obj-coff.h,v
retrieving revision 1.34
diff -u -p -r1.34 obj-coff.h
--- gas/config/obj-coff.h	27 Oct 2005 07:40:07 -0000	1.34
+++ gas/config/obj-coff.h	26 Apr 2006 11:26:01 -0000
@@ -59,14 +59,14 @@
 #ifdef TC_I386
 #include "coff/i386.h"
 
+#ifndef TARGET_FORMAT
 #ifdef TE_PE
 #define TARGET_FORMAT "pe-i386"
-#endif
-
-#ifndef TARGET_FORMAT
+#else
 #define TARGET_FORMAT "coff-i386"
 #endif
 #endif
+#endif
 
 #ifdef TC_M68K
 #include "coff/m68k.h"

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* RE: Mainline and branch: --enable-targets=all dead on cygwin
  2006-04-26 14:38     ` Alan Modra
@ 2006-04-26 16:59       ` Dave Korn
  2006-04-26 18:18         ` Dave Korn
  2006-04-26 20:07         ` Alan Modra
  0 siblings, 2 replies; 8+ messages in thread
From: Dave Korn @ 2006-04-26 16:59 UTC (permalink / raw)
  To: 'Alan Modra'; +Cc: 'Nick Clifton', binutils

On 26 April 2006 12:31, Alan Modra wrote:

> On Wed, Apr 26, 2006 at 10:41:08AM +0100, Dave Korn wrote:
>>   I just filed a PR as it was still happening to me last night.  Maybe
>> something in my cygwin installation isn't fully up-to-date; I'll make sure
>> I've got the latest everything and double-check.
> 
> It's a bug.  Try this.
> 

  Thanks Alan, that was what I thought might be the answer, and it does indeed
solve that problem.  The build still doesn't complete, though, since as
reported in 
http://sourceware.org/ml/binutils/2006-04/msg00257.html
we run up against a missing sybol later:

mkdir .libs
gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -o
as-new.e
xe app.o as.o atof-generic.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o
eho
pt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o
input-file
.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o
sb.
o stabs.o subsegs.o symbols.o write.o tc-i386.o obj-multi.o atof-ieee.o
obj-coff
.o obj-aout.o obj-elf.o e-i386coff.o e-i386aout.o e-i386elf.o
../bfd/.libs/libb
fd.a ../libiberty/libiberty.a ./../intl/libintl.a
obj-coff.o: In function `coff_frob_symbol':
/usr/build/src-binutils/gas/config/obj-coff.c:1055: undefined reference to
`_an_external_name'
collect2: ld returned 1 exit status
make[4]: *** [as-new.exe] Error 1

  This is due to the fact that USE_UNIQUE is not defined when symbols.c is
compiled, which looks to me to be some kind of problem in the include file
hierarchy; when TE_PE, USE_UNIQUE gets defined in obj-coff.h, but symbols.c
doesn't appear to think it needs to include OBJ_HEADER.  Any ideas about that?



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

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

* RE: Mainline and branch: --enable-targets=all dead on cygwin
  2006-04-26 16:59       ` Dave Korn
@ 2006-04-26 18:18         ` Dave Korn
  2006-04-26 20:07         ` Alan Modra
  1 sibling, 0 replies; 8+ messages in thread
From: Dave Korn @ 2006-04-26 18:18 UTC (permalink / raw)
  To: 'Alan Modra'; +Cc: 'Nick Clifton', binutils

On 26 April 2006 12:59, Dave Korn wrote:


> obj-coff.o: In function `coff_frob_symbol':
> /usr/build/src-binutils/gas/config/obj-coff.c:1055: undefined reference to
> `_an_external_name'
> collect2: ld returned 1 exit status
> make[4]: *** [as-new.exe] Error 1
> 
>   This is due to the fact that USE_UNIQUE is not defined when symbols.c is
> compiled, which looks to me to be some kind of problem in the include file
> hierarchy; when TE_PE, USE_UNIQUE gets defined in obj-coff.h, but symbols.c
> doesn't appear to think it needs to include OBJ_HEADER.  Any ideas about
> that? 


  Hmm, I've got some myself, and they're starting to look like "This has never
been multi-arch[*] compatible, has it?"

  Seems to me that USE_UNIQUE is a pe-coff thing, and so only gets defined
when obj-format.h points directly to obj-coff.h, and not when it points to
obj-multi.h.

  Which in turn suggests to me that the variable needs to be defined always
and the relevant code included in an appropriate run-time if (...) test rather
than a compile-time #if test.  I dunno how multi-arch works in binutils/gas
yet, but I'll take a browse through obj-multi.[ch] and see if I can work out
the equivalent runtime test to "#ifdef USE_UNIQUE", which shoudl be something
more-or-less along the lines of "if current output object format is pe-coff",
/I think/.


    cheers,
      DaveK
[*] - deliberate misapplication of gdb terminology i know i know!
-- 
Can't think of a witty .sigline today....

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

* Re: Mainline and branch: --enable-targets=all dead on cygwin
  2006-04-26 16:59       ` Dave Korn
  2006-04-26 18:18         ` Dave Korn
@ 2006-04-26 20:07         ` Alan Modra
  2006-05-29 18:00           ` Aaron W. LaFramboise
  1 sibling, 1 reply; 8+ messages in thread
From: Alan Modra @ 2006-04-26 20:07 UTC (permalink / raw)
  To: Dave Korn; +Cc: 'Nick Clifton', binutils

On Wed, Apr 26, 2006 at 12:58:32PM +0100, Dave Korn wrote:
>   This is due to the fact that USE_UNIQUE is not defined when symbols.c is
> compiled, which looks to me to be some kind of problem in the include file
> hierarchy; when TE_PE, USE_UNIQUE gets defined in obj-coff.h, but symbols.c
> doesn't appear to think it needs to include OBJ_HEADER.  Any ideas about that?

Yeah, throw rocks at whoever put that code in.  :)

With --enable-targets=all, you are trying to build i386 gas with AOUT,
COFF and ELF support.  That means anything format specific needs to be
selected at runtime depending on the output.  See config/obj-multi.h.
There are a depressing number of ocurrences of #ifdef TE_PE scattered
around the gas code.  For an easy fix, just turn off the multi-obj
support by editing gas/configure.in.  Tweak the case statement just
after 
# Turn on all targets if possible
to exclude pe targets.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* Re: Mainline and branch: --enable-targets=all dead on cygwin
  2006-04-26 20:07         ` Alan Modra
@ 2006-05-29 18:00           ` Aaron W. LaFramboise
  0 siblings, 0 replies; 8+ messages in thread
From: Aaron W. LaFramboise @ 2006-05-29 18:00 UTC (permalink / raw)
  To: Dave Korn, 'Nick Clifton', binutils

Alan Modra wrote:
> On Wed, Apr 26, 2006 at 12:58:32PM +0100, Dave Korn wrote:
>>   This is due to the fact that USE_UNIQUE is not defined when symbols.c is
>> compiled, which looks to me to be some kind of problem in the include file
>> hierarchy; when TE_PE, USE_UNIQUE gets defined in obj-coff.h, but symbols.c
>> doesn't appear to think it needs to include OBJ_HEADER.  Any ideas about that?
> 
> Yeah, throw rocks at whoever put that code in.  :)


That would be me...

After I added this, some problems came up, and I think some stuff got 
moved around...

All of those TE_PE's need to be abstracted out with hooks to where they 
belong.

Right now, I'm working on a patch to fix a number of related issues with 
weak support that have come up, and I will prepare a patch to move as 
many of these TE_PE's etc as I can back out of gas, as well.  This 
should resolve this issue.

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

end of thread, other threads:[~2006-05-27 20:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-19 16:27 Mainline and branch: --enable-targets=all dead on cygwin Dave Korn
2006-04-26 11:31 ` Nick Clifton
2006-04-26 12:47   ` Dave Korn
2006-04-26 14:38     ` Alan Modra
2006-04-26 16:59       ` Dave Korn
2006-04-26 18:18         ` Dave Korn
2006-04-26 20:07         ` Alan Modra
2006-05-29 18:00           ` Aaron W. LaFramboise

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).