This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: gcc compiles assert() to code that requires linking withgcc


>>>>> "Martin" == Martin Buchholz <martin@xemacs.org> writes:

    Martin> Could we have an "official" policy statement from the GCC
    Martin> development team on this?

I am a member of the GCC Steering Committee, but I cannot speak for
the SC as whole.  Thus, my statements count for something, but they're
by no means the final word.

There are two issues here:

  - Should GCC compiled libraries have, under any circumstances,
    dependencies on libgcc?

  - Should using `assert' result in a dependency on libgcc?

The answer to the first question is definitely yes.  For example, GCC
uses libgcc to provide floating point emulation for processors that do
not support floating point.  GCC uses libgcc to provide support for
exception-handling and global initialization in C++ and Java, as
appropriate.

However, the fewer dependencies on libgcc the better, all things being
equal.  If you can implement assert in a way that is not detrimental
in other ways, but does provide the benefit that simply using `assert'
does not pull in libgcc, that sounds fine to me.  You still should not
depend on being able to avoid linking in libgcc; it may well be needed
for other purposes.

You mention the practices of other compiler vendors.  Many compiler
vendors include functionality equivalent to libgcc in the OS C
library.  GCC cannot do that, in general, since the GCC developers
have no control over the OS C library.  So, a separate library is used
instead.

In short, when you imply that the output of most compilers works
without linking in a special library, you're incorrect; it's just that
the library you must link in is the C library, which you probably
wanted to link in anyhow.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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