Bug 163099 - gcj - undefined references when linking multiple .java files with a static lib
gcj - undefined references when linking multiple .java files with a static lib
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Tromey
Depends On:
  Show dependency treegraph
Reported: 2005-07-12 17:28 EDT by Ivan Pantuyev
Modified: 2014-08-11 01:46 EDT (History)
3 users (show)

See Also:
Fixed In Version: 4.0.1-3
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-07-15 07:48:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
a testcase. (40.00 KB, application/x-tar)
2005-07-12 17:35 EDT, Ivan Pantuyev
no flags Details

  None (edit)
Description Ivan Pantuyev 2005-07-12 17:28:42 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.8) Gecko/20050623 Fedora/1.0.4-5 Firefox/1.0.4

Description of problem:
When compiling multiple (as opposed to a single) java source files and linking with a static library the linker gives unresolved symbols for the classes in the library.
If you examine gcj -v output you can see that the library parameters to collect2 are out of order.
Compiling a single file works, so does compiling multiple into objects and then linking.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Create a static library
2. Create at least two files, one of which uses a class in the library
3. Compile linking to library

Actual Results:  Undefined reference of the classes in the library

Expected Results:  Should compile

Additional info:

collect2 ... /tmp/ccTBtUMj.o libtest.a /tmp/cc5arF0n.o ...
/tmp/cc5arF0n.o(.text+0x38): In function `Main::main(JArray<java::lang::String*>*)':
ccVcD1Gyjx: undefined reference to `TestClass::class$
Comment 1 Ivan Pantuyev 2005-07-12 17:35:42 EDT
Created attachment 116686 [details]
a testcase. 

check Makefile targets, it also tests that single file works fine and that
compiling to objects works fine.
Comment 2 Tom Tromey 2005-07-12 18:09:37 EDT
I'm testing a patch.
Comment 3 Tom Tromey 2005-07-13 12:22:06 EDT
Patch submitted:
Comment 4 Tom Tromey 2005-07-13 12:45:47 EDT
I checked the fix in to gcc cvs head.
I'm not really sure what to do with this PR... close it?
Put the bug in RH gcc 4.0.1 and close it?
Comment 6 Jakub Jelinek 2005-07-15 07:48:29 EDT
This is in gcc-4.0.1-3 in rawhide.

Note You need to log in before you can comment on or make changes to this bug.