This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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] | |
Hi everyone,
I couldn't build all targets on cygwin the other day:
http://sourceware.org/ml/binutils/2005-04/msg00772.html
Well, include/coff/tic80.h has this chunk...
/* Names of "special" sections. */
#define _TEXT ".text"
#define _DATA ".data"
#define _BSS ".bss"
#define _CINIT ".cinit"
#define _CONST ".const"
#define _SWITCH ".switch"
#define _STACK ".stack"
#define _SYSMEM ".sysmem"
... that defines some system-specific names for linker sections. Now I'm
building on a newlib-based host (cygwin), and newlib has a host header
called _ansi.h (which is included from stdio.h, which is pulled in by
sysdep.h), which includes these definitions:
#ifdef _HAVE_STDC
#define _PTR void *
#define _AND ,
#define _NOARGS void
#define _CONST const
#define _VOLATILE volatile
[etc etc.]
and so the build fails in bfd/coff-tic80.c, with a macro redefinition
error:
In file included from /usr/build/binutils-src/src/bfd/coff-tic80.c:31:
/usr/build/binutils-src/src/include/coff/tic80.h:71:1: "_CONST" redefined
In file included from /usr/include/stdio.h:29,
from /usr/build/binutils-src/src/bfd/sysdep.h:33,
from /usr/build/binutils-src/src/bfd/coff-tic80.c:29:
/usr/include/_ansi.h:30:1: this is the location of the previous definition
Nick suggested killing the definition in tic80.h, but I'm not sure,
because it's a user-visible include file, and it might impact people's code.
_CONST belongs to the system namespace. tic80.h is effectively a tic system
header; it's within its rights to define _CONST if that's how it's defined
in the native system library. And newlib's _ansi.h is also a system header;
it too is within its rights to define _CONST.
I imagine this hasn't come up before because nobody has been building
tic-targeted binutils on newlib-based hosts. Being a small embedded target,
tic itself is probably a newlib target (I haven't checked), and I'm also
guessing that it's not self-hosting so nobody's been building bfd on it or
they would have come across this problem. So it may well be that binutils
itself is in fact the only application code anywhere that references this
header. But OTOH, if there is anyone out there using it, they will have
already come across this problem and arranged their own local solution for
which symbol they wanted defined.
So I figured it was most minimally-invasive to take care of the clash in
the one and only source file that actually references both these headers,
coff-tic80.c. Here's the patch I used to do so. It's not tested yet
because there's another clash later on in the build, but it makes the build
succeed and it's pretty trivial; I'd call it 'obvious'. I'll take a look at
the TARGET_FORMAT trouble next.
2005-05-07 Dave Korn <dave.korn@artimi.com>
bfd/
* coff-tic80.c: Undefine _CONST after system headers to prevent
clash with tic80-specific definition in include/coff/tic80.h.
cheers,
DaveK
--
Can't think of a witty .sigline today....
Attachment:
newlib-vs-tic80-patch.diff
Description: Binary data
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |