Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 163099 - gcj - undefined references when linking multiple .java files with a static lib
Summary: gcj - undefined references when linking multiple .java files with a static lib
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tom Tromey
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-07-12 21:28 UTC by Ivan Pantuyev
Modified: 2014-08-11 05:46 UTC (History)
3 users (show)

Fixed In Version: 4.0.1-3
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-07-15 11:48:29 UTC


Attachments (Terms of Use)
a testcase. (deleted)
2005-07-12 21:35 UTC, Ivan Pantuyev
no flags Details

Description Ivan Pantuyev 2005-07-12 21:28:42 UTC
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):
gcc-4.0.1-2

How reproducible:
Always

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 21:35:42 UTC
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 22:09:37 UTC
I'm testing a patch.


Comment 3 Tom Tromey 2005-07-13 16:22:06 UTC
Patch submitted:
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00926.html

Comment 4 Tom Tromey 2005-07-13 16:45:47 UTC
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 11:48:29 UTC
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.