summaryrefslogtreecommitdiff
path: root/share/doc/gcc/Interoperation.html
diff options
context:
space:
mode:
Diffstat (limited to 'share/doc/gcc/Interoperation.html')
-rw-r--r--share/doc/gcc/Interoperation.html236
1 files changed, 236 insertions, 0 deletions
diff --git a/share/doc/gcc/Interoperation.html b/share/doc/gcc/Interoperation.html
new file mode 100644
index 0000000..01d9563
--- /dev/null
+++ b/share/doc/gcc/Interoperation.html
@@ -0,0 +1,236 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- This file documents the use of the GNU compilers.
+
+Copyright (C) 1988-2023 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with the
+Invariant Sections being "Funding Free Software", the Front-Cover
+Texts being (a) (see below), and with the Back-Cover Texts being (b)
+(see below). A copy of the license is included in the section entitled
+"GNU Free Documentation License".
+
+(a) The FSF's Front-Cover Text is:
+
+A GNU Manual
+
+(b) The FSF's Back-Cover Text is:
+
+You have freedom to copy and modify this GNU Manual, like GNU
+ software. Copies published by the Free Software Foundation raise
+ funds for GNU development. -->
+<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
+<head>
+<title>Using the GNU Compiler Collection (GCC): Interoperation</title>
+
+<meta name="description" content="Using the GNU Compiler Collection (GCC): Interoperation">
+<meta name="keywords" content="Using the GNU Compiler Collection (GCC): Interoperation">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="Generator" content="makeinfo">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<link href="index.html#Top" rel="start" title="Top">
+<link href="Indices.html#Indices" rel="index" title="Indices">
+<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
+<link href="Trouble.html#Trouble" rel="up" title="Trouble">
+<link href="Incompatibilities.html#Incompatibilities" rel="next" title="Incompatibilities">
+<link href="Actual-Bugs.html#Actual-Bugs" rel="previous" title="Actual Bugs">
+<style type="text/css">
+<!--
+a.summary-letter {text-decoration: none}
+blockquote.smallquotation {font-size: smaller}
+div.display {margin-left: 3.2em}
+div.example {margin-left: 3.2em}
+div.indentedblock {margin-left: 3.2em}
+div.lisp {margin-left: 3.2em}
+div.smalldisplay {margin-left: 3.2em}
+div.smallexample {margin-left: 3.2em}
+div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
+div.smalllisp {margin-left: 3.2em}
+kbd {font-style:oblique}
+pre.display {font-family: inherit}
+pre.format {font-family: inherit}
+pre.menu-comment {font-family: serif}
+pre.menu-preformatted {font-family: serif}
+pre.smalldisplay {font-family: inherit; font-size: smaller}
+pre.smallexample {font-size: smaller}
+pre.smallformat {font-family: inherit; font-size: smaller}
+pre.smalllisp {font-size: smaller}
+span.nocodebreak {white-space:nowrap}
+span.nolinebreak {white-space:nowrap}
+span.roman {font-family:serif; font-weight:normal}
+span.sansserif {font-family:sans-serif; font-weight:normal}
+ul.no-bullet {list-style: none}
+-->
+</style>
+
+
+</head>
+
+<body lang="en_US" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
+<a name="Interoperation"></a>
+<div class="header">
+<p>
+Next: <a href="Incompatibilities.html#Incompatibilities" accesskey="n" rel="next">Incompatibilities</a>, Previous: <a href="Actual-Bugs.html#Actual-Bugs" accesskey="p" rel="previous">Actual Bugs</a>, Up: <a href="Trouble.html#Trouble" accesskey="u" rel="up">Trouble</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
+</div>
+<hr>
+<a name="Interoperation-1"></a>
+<h3 class="section">14.2 Interoperation</h3>
+
+<p>This section lists various difficulties encountered in using GCC
+together with other compilers or with the assemblers, linkers,
+libraries and debuggers on certain systems.
+</p>
+<ul>
+<li> On many platforms, GCC supports a different ABI for C++ than do other
+compilers, so the object files compiled by GCC cannot be used with object
+files generated by another C++ compiler.
+
+<p>An area where the difference is most apparent is name mangling. The use
+of different name mangling is intentional, to protect you from more subtle
+problems.
+Compilers differ as to many internal details of C++ implementation,
+including: how class instances are laid out, how multiple inheritance is
+implemented, and how virtual function calls are handled. If the name
+encoding were made the same, your programs would link against libraries
+provided from other compilers&mdash;but the programs would then crash when
+run. Incompatible libraries are then detected at link time, rather than
+at run time.
+</p>
+</li><li> On some BSD systems, including some versions of Ultrix, use of profiling
+causes static variable destructors (currently used only in C++) not to
+be run.
+
+</li><li> On a SPARC, GCC aligns all values of type <code>double</code> on an 8-byte
+boundary, and it expects every <code>double</code> to be so aligned. The Sun
+compiler usually gives <code>double</code> values 8-byte alignment, with one
+exception: function arguments of type <code>double</code> may not be aligned.
+
+<p>As a result, if a function compiled with Sun CC takes the address of an
+argument of type <code>double</code> and passes this pointer of type
+<code>double *</code> to a function compiled with GCC, dereferencing the
+pointer may cause a fatal signal.
+</p>
+<p>One way to solve this problem is to compile your entire program with GCC.
+Another solution is to modify the function that is compiled with
+Sun CC to copy the argument into a local variable; local variables
+are always properly aligned. A third solution is to modify the function
+that uses the pointer to dereference it via the following function
+<code>access_double</code> instead of directly with &lsquo;<samp>*</samp>&rsquo;:
+</p>
+<div class="smallexample">
+<pre class="smallexample">inline double
+access_double (double *unaligned_ptr)
+{
+ union d2i { double d; int i[2]; };
+
+ union d2i *p = (union d2i *) unaligned_ptr;
+ union d2i u;
+
+ u.i[0] = p-&gt;i[0];
+ u.i[1] = p-&gt;i[1];
+
+ return u.d;
+}
+</pre></div>
+
+<p>Storing into the pointer can be done likewise with the same union.
+</p>
+</li><li> On Solaris, the <code>malloc</code> function in the <samp>libmalloc.a</samp> library
+may allocate memory that is only 4 byte aligned. Since GCC on the
+SPARC assumes that doubles are 8 byte aligned, this may result in a
+fatal signal if doubles are stored in memory allocated by the
+<samp>libmalloc.a</samp> library.
+
+<p>The solution is to not use the <samp>libmalloc.a</samp> library. Use instead
+<code>malloc</code> and related functions from <samp>libc.a</samp>; they do not have
+this problem.
+</p>
+</li><li> On the HP PA machine, ADB sometimes fails to work on functions compiled
+with GCC. Specifically, it fails to work on functions that use
+<code>alloca</code> or variable-size arrays. This is because GCC doesn&rsquo;t
+generate HP-UX unwind descriptors for such functions. It may even be
+impossible to generate them.
+
+</li><li> Debugging (<samp>-g</samp>) is not supported on the HP PA machine, unless you use
+the preliminary GNU tools.
+
+</li><li> Taking the address of a label may generate errors from the HP-UX
+PA assembler. GAS for the PA does not have this problem.
+
+</li><li> Using floating point parameters for indirect calls to static functions
+will not work when using the HP assembler. There simply is no way for GCC
+to specify what registers hold arguments for static functions when using
+the HP assembler. GAS for the PA does not have this problem.
+
+</li><li> In extremely rare cases involving some very large functions you may
+receive errors from the HP linker complaining about an out of bounds
+unconditional branch offset. This used to occur more often in previous
+versions of GCC, but is now exceptionally rare. If you should run
+into it, you can work around by making your function smaller.
+
+</li><li> GCC compiled code sometimes emits warnings from the HP-UX assembler of
+the form:
+
+<div class="smallexample">
+<pre class="smallexample">(warning) Use of GR3 when
+ frame &gt;= 8192 may cause conflict.
+</pre></div>
+
+<p>These warnings are harmless and can be safely ignored.
+</p>
+</li><li> In extremely rare cases involving some very large functions you may
+receive errors from the AIX Assembler complaining about a displacement
+that is too large. If you should run into it, you can work around by
+making your function smaller.
+
+</li><li> The <samp>libstdc++.a</samp> library in GCC relies on the SVR4 dynamic
+linker semantics which merges global symbols between libraries and
+applications, especially necessary for C++ streams functionality.
+This is not the default behavior of AIX shared libraries and dynamic
+linking. <samp>libstdc++.a</samp> is built on AIX with &ldquo;runtime-linking&rdquo;
+enabled so that symbol merging can occur. To utilize this feature,
+the application linked with <samp>libstdc++.a</samp> must include the
+<samp>-Wl,-brtl</samp> flag on the link line. G++ cannot impose this
+because this option may interfere with the semantics of the user
+program and users may not always use &lsquo;<samp>g++</samp>&rsquo; to link his or her
+application. Applications are not required to use the
+<samp>-Wl,-brtl</samp> flag on the link line&mdash;the rest of the
+<samp>libstdc++.a</samp> library which is not dependent on the symbol
+merging semantics will continue to function correctly.
+
+</li><li> An application can interpose its own definition of functions for
+functions invoked by <samp>libstdc++.a</samp> with &ldquo;runtime-linking&rdquo;
+enabled on AIX. To accomplish this the application must be linked
+with &ldquo;runtime-linking&rdquo; option and the functions explicitly must be
+exported by the application (<samp>-Wl,-brtl,-bE:exportfile</samp>).
+
+</li><li> AIX on the RS/6000 provides support (NLS) for environments outside of
+the United States. Compilers and assemblers use NLS to support
+locale-specific representations of various objects including
+floating-point numbers (&lsquo;<samp>.</samp>&rsquo; vs &lsquo;<samp>,</samp>&rsquo; for separating decimal
+fractions). There have been problems reported where the library linked
+with GCC does not produce the same floating-point formats that the
+assembler accepts. If you have this problem, set the <code>LANG</code>
+environment variable to &lsquo;<samp>C</samp>&rsquo; or &lsquo;<samp>En_US</samp>&rsquo;.
+
+</li><li> <a name="index-fdollars_002din_002didentifiers-1"></a>
+Even if you specify <samp>-fdollars-in-identifiers</samp>,
+you cannot successfully use &lsquo;<samp>$</samp>&rsquo; in identifiers on the RS/6000 due
+to a restriction in the IBM assembler. GAS supports these
+identifiers.
+
+</li></ul>
+
+<hr>
+<div class="header">
+<p>
+Next: <a href="Incompatibilities.html#Incompatibilities" accesskey="n" rel="next">Incompatibilities</a>, Previous: <a href="Actual-Bugs.html#Actual-Bugs" accesskey="p" rel="previous">Actual Bugs</a>, Up: <a href="Trouble.html#Trouble" accesskey="u" rel="up">Trouble</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
+</div>
+
+
+
+</body>
+</html>