I forgot to mention that IPA assumes that the entire program
is being analyzed, which is not the case when a shared library
is produced with IPA.

Thus it is possible that IPA will determine that there is no
aliasing between two memory references when producing the
shared object, but it is possible to construct a program that
is linked against the shared object, where the two references
do alias.

Attached is a program which breaks when IPA is used to produced a
shared object.

AMD's Open64 user's guide mentions this issue (see -shared option).

Doug

PS: Yes, this is a contrived example, and I don't think we
have actually seen this problem exposed in practice.
> -----Original Message-----
> From: Gilmore, Doug
> Sent: Monday, October 25, 2010 2:31 PM
> To: 'Tianwei'; Pengqi Cheng
> Cc: open64-devel@lists.sourceforge.net
> Subject: RE: [Open64-devel] Can ipa_link link static libraries?
> 
> > Hi,
> >     which opencc version do you use?  I have the following case:
> > tian...@tianwei:~/test$ cat test.c
> > int main() {
> >  foo();
> >  printf("hello world\n");
> > }
> >
> > tian...@tianwei:~/test$ cat foo.c
> > #include <stdio.h>
> > void foo(){
> >   printf("we are in foo!\n");
> > }
> >
> > first I build the .a file as:
> > tian...@tianwei:~/test$ gcc foo.c -fPIC -c -o foo.o
> > tian...@tianwei:~/test$ ar rcs foo.a foo.o
> >
> > then I build .so file with opencc as:
> > tian...@tianwei:~/test$ opencc -ipa test.c foo.a -shared -o test.so
> >
> > I do not get any error for this simple case:
> > tian...@tianwei:~/test$ file test.so
> > test.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
> dynamically linked, not stripped
> >
> > I think this mixed libraries problem has been solved before, or I
> > misunderstood what you were saying.
> Actually there still is an issue with mixed libraries:
> 
> https://bugs.open64.net/show_bug.cgi?id=683
> 
> It more of an issue with the linker than with Open64.
> 
> Doug
> >
> >
> > Tianwei
> >
> > On Mon, Oct 25, 2010 at 10:40 PM, Pengqi Cheng <chen...@gmail.com>
> wrote:
> > Hi,
> >
> > I want to use ipa_link to link some .o and .a files into one .so.
> However, the compiler returns following error:
> > Error: Can't read IPA input file: ***.a
> > Of course ipa_link links special ipa .o files, but is there any
> solution to use ipa_link to combine ipa's .o output and other standard
> static libraries?
> > Thanks for any suggestion.
> >
> > --
> > Sheng, Tianwei
> > Inst. of High Performance Computing
> > Dept. of Computer Sci. & Tech.
> > Tsinghua Univ.
> >

Attachment: ipa_so_test.tar.gz
Description: ipa_so_test.tar.gz

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to