From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9789 invoked by alias); 4 Jan 2010 15:43:09 -0000 Received: (qmail 9704 invoked by uid 48); 4 Jan 2010 15:42:53 -0000 Date: Mon, 04 Jan 2010 15:43:00 -0000 Message-ID: <20100104154253.9703.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/42568] [Cygwin] BLOCKDATA referenced in EXTERNAL not loading from library In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "davek at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-01/txt/msg00399.txt.bz2 ------- Comment #12 from davek at gcc dot gnu dot org 2010-01-04 15:42 ------- COMMON symbols don't cause members to be pulled in from library archives. You can omit "-L. -lex" from the final link altogether and get the same result: it's unused. So the reference from bug.o to _jindx2 doesn't cause the library archive member to be drawn into the final link. With g77, there's this additional undefined symbol _juinit2_ in bug.o, which is not common, and hence causes the libex.a(juinit2.o) member to be drawn into the final link, at which time the explicit definition of _jindx2 overrides the common definition. gfortran doesn't generate any reference to _juinit2_ when it is used to compile bug.f, so there is nothing left to pull the archive member into the final link. The reference to _juinit2_ that g77 generates while compiling bug.f but gfortran does not generate has a label associated with it that suggests very strongly that g77 was aware of the problem that common symbols don't pull in lib archive members and uses this reference to an associated non-common symbol deliberately to solve the problem: .file "bug.f" .data .align 4 ___g77_forceload_0.0: .long _juinit2_ The "forceload" bit seems highly suggestive. Does gfortran need to adopt this part of g77's mechanism? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42568