Multiply-defined global symbols

Julian Brown <brown@cs.bris.ac.uk>
4 Oct 2003 14:45:31 -0400

          From comp.compilers

Related articles
Multiply-defined global symbols brown@cs.bris.ac.uk (Julian Brown) (2003-10-04)
Re: Multiply-defined global symbols gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-10-06)
Re: Multiply-defined global symbols derkgwen@HotPOP.com (Derk Gwen) (2003-10-06)
Re: Multiply-defined global symbols kenrose@tfb.com (Ken Rose) (2003-10-06)
| List of all articles for this month |

From: Julian Brown <brown@cs.bris.ac.uk>
Newsgroups: comp.compilers
Date: 4 Oct 2003 14:45:31 -0400
Organization: University of Bristol
Keywords: symbols, linker
Posted-Date: 04 Oct 2003 14:45:31 EDT

Hi,


I'm working on a port of GCC and Newlib to a new architecture, with my
own assembler and linker(*). I have a question that I'm not having much
luck finding the answer to. Mostly, my problem is with a "throwaway"
remark in one of the Newlib configuration scripts:


# The functions ldexp, frexp and modf are traditionally supplied in
# both libc.a and libm.a. We build them in libm.a and copy them over,
# along with some required supporting routines.


Now, in my mind that means there will be multiple definitions of those
functions, which will be an error when linking a program with the math
library (-lm). And in fact, that's exactly what's happening unless I
hack that particular "feature" out of Newlib.


So, is my understanding of global symbols (perhaps with particular
reference to libraries) generally incorrect? Is it OK to have multiple
global definitions of the same functions? Should I be looking at the
actual code referred to by the symbols and only complaining if it's
different, or something? (yuck!)


Julian


* At the time I felt my architecture was sufficiently "different" to
warrant this, rather than porting the GNU tools.



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.