public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Issue on X86_64?
@ 2008-03-25 21:06 Lorenzo Pesce
  2008-03-26 10:03 ` Andrew Haley
  0 siblings, 1 reply; 13+ messages in thread
From: Lorenzo Pesce @ 2008-03-25 21:06 UTC (permalink / raw)
  To: gcc-help

Dear all,
I am preparing some free software that needs to work on different  
platforms (OS X, windows, Linux  x  32,64).
One problem I have is that this system is based upon a fortran core,  
a set of routines that do statistical calculations, which is used  
differently by either fortran, c or java drivers.

I package the procedures (.o) in three formats: a libroc.a and  
libroc.so and a libroc.so (as a jni lib).
I usually link the pieces of libgfortran.a (ar -x ...) so that users  
do not need to have libgfortran on their system. I then include those  
pieces when I build all the libraries.

The three formats build and work fine under gcc-4.1.1 on OS X 10.4  
(G4 or Xeon) and Linux Intel 32.

However, when I get to X86 (whether Intel or AMD) it does not work  
anymore. I can compile the files, and build the static library  
libroc.a. It works fine and I can move it from AMD to intel (not the  
other way around, but I assume it is a problem with my installation).  
However, when I try to build a dynamically linked library, gcc  
complains that
"Relocation R_X86_64_32 against 'a local symbol' can not be used when  
making a share object; recompile with -fPIC"
then it tells me it can't read symbols .o because it is a bad value.

If I link the libgfortran.so or load the libgfortran.so it works  for  
R. However, the result works either on AMD or Intel.

However, it does not work for the java jnilib because it thinks that  
it is the wrong ELF class: ELFCLASS64 (which it is).

I would like to use the .o's of libgfortran directly because that  
would allow me to have a single library for both Intel and AMD and  
also to make my development tree somewhat simpler. Not to mention  
that I would like to understand what is happening.

What am I doing wrong?

Lorenzo

^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <20080328191557.BDJ30009@m4500-01.uchicago.edu>]
* Re: Issue on X86_64?
@ 2008-03-29  3:21 Lorenzo Pesce
  2008-03-29  4:17 ` Ian Lance Taylor
  0 siblings, 1 reply; 13+ messages in thread
From: Lorenzo Pesce @ 2008-03-29  3:21 UTC (permalink / raw)
  To: David Daney; +Cc: gcc help

Thanks for your reply David,

>> Much easier for me would be to have access to the objects of
>> libgortran.a compiled as PIC. I don't care for many parts of
>> the .so because the code runs only as a library.
>> 
>> 
>> Does it make sense?
>
> I understand what you are saying, but I don't necessarily 
> agree that it is the 'right thing to do'.

It is the best solution I could find. I would love to hear 
a better idea because there is something illogical about this
"fix", but still, it seems to be the smallest evil.


>The object files you need exist somewhere in the gcc build
> tree (but not in any archive), you need to figure out how
> to get them out.

It seems like they are in "objdir"/x86_64-xxx-gnu/libgfortran.
Unfortunately, the .o do not seem to be build with as PIC and
the .lo do not seem to be digestible by g++, gcc. So I don't
know how to coax them into a dyn lib.

This why I thought to rebuild the gfortran's .o with -fPIC, 
but got baffled by Makefiles and config files. I could not 
find any mention of it anywhere. 
 
Any ideas?

Thanks again, and sorry for taking up so much bandwidth, I 
hope it is of some interest to other people as well.

Lorenzo

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-03-29  4:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-25 21:06 Issue on X86_64? Lorenzo Pesce
2008-03-26 10:03 ` Andrew Haley
2008-03-28 17:20   ` Lorenzo Pesce
2008-03-28 17:45     ` Andrew Haley
2008-03-28 17:57       ` Lorenzo Pesce
2008-03-28 18:07         ` Andrew Haley
2008-03-28 18:41           ` Lorenzo Pesce
2008-03-28 19:55             ` Andrew Haley
2008-03-28 22:31               ` Lorenzo Pesce
2008-03-28 22:51                 ` David Daney
     [not found] <20080328191557.BDJ30009@m4500-01.uchicago.edu>
2008-03-29  1:02 ` David Daney
2008-03-29  3:21 Lorenzo Pesce
2008-03-29  4:17 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).