<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Position Independent Code in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319999#M712207</link>
    <description>Just going through a .s file won't help performance.  You might improve performance if you rewrite that .s file using particular assembly language operations that the compiler is not using.  That is only likely if you are an expert with the assembly language and you know something about the code that can't be expressed in the C language.  The compiler might not know that parameters almost always have a few particular values or that some cases are exceptionally common.&lt;BR /&gt;  You can help the compiler with some of those details by using 'profile based optimization'.  That lets the compiler refer back to information recorded by previous runs of the code.  It is discussed in the optimization section of the 'C Programmer's Guide' at &lt;A href="http://www.docs.hp.com./hpux/onlinedocs/92434-90011/92434-90011.html" target="_blank"&gt;http://www.docs.hp.com./hpux/onlinedocs/92434-90011/92434-90011.html&lt;/A&gt;</description>
    <pubDate>Tue, 06 Jul 2004 10:22:28 GMT</pubDate>
    <dc:creator>Mike Stroyan</dc:creator>
    <dc:date>2004-07-06T10:22:28Z</dc:date>
    <item>
      <title>Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319989#M712197</link>
      <description>How to create Position Independent Code using HP's assembler "as" command?&lt;BR /&gt;&lt;BR /&gt;I am trying to compile "Openssl on HPUX 10.20"&lt;BR /&gt;&lt;BR /&gt;# uname -a&lt;BR /&gt;HP-UX SIS B.10.20 A 9000/867 ........&lt;BR /&gt;&lt;BR /&gt;There is a "pa-risc.s" file&lt;BR /&gt;I am trying to produce pa-risc.o file using following command.&lt;BR /&gt;&lt;BR /&gt;# as +z pa-risc.s -o pa-risc.o&lt;BR /&gt;&lt;BR /&gt;it is producing pa-risc.o file however with lot of warnings, some of the warning are...&lt;BR /&gt;&lt;BR /&gt;as: "pa-risc.s", line 649: warning 36: Use of %fr10R is incorrect for the current LEVEL of 1.0&lt;BR /&gt;as: "pa-risc.s", line 649: warning 36: Use of XMPYU is incorrect for the current LEVEL of 1.0&lt;BR /&gt;as: "pa-risc.s", line 651: warning 36: Use of %fr9R is incorrect for the current LEVEL of 1.0&lt;BR /&gt;.......etc.&lt;BR /&gt;&lt;BR /&gt;and when i build to produce shared library and i am getting following error&lt;BR /&gt;&lt;BR /&gt;/usr/ccs/bin/ld: DP relative code in file libcrypto.a(pa-risc.o) - shared library must be position&lt;BR /&gt;    independent.  Use +z or +Z to recompile.&lt;BR /&gt;*** Error exit code 1&lt;BR /&gt;&lt;BR /&gt;what is going wrong :(, my unix knowledge is very less, can any body help me?&lt;BR /&gt;&lt;BR /&gt;I also tried to produce pa-risc.o file with GNU binutil 2.11.2 "as". it is producing .o file without any problem, however it is not a PIC code, I am unable to find a way to produce PIC code with GNU's "as"&lt;BR /&gt;&lt;BR /&gt;pa-risc.s file is attached with the message&lt;BR /&gt;&lt;BR /&gt;please help me to solve this problem</description>
      <pubDate>Thu, 01 Jul 2004 02:00:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319989#M712197</guid>
      <dc:creator>kishore_10</dc:creator>
      <dc:date>2004-07-01T02:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319990#M712198</link>
      <description>the linker is telling you the compiler option to use (it thinks you compiled a c program). i think, unfortunately it is at the assembly code level that the difference between pic and non-pic code lies - to get pic code you have to write pic code in the assembly. the code you have was not written pic and hence not for a shared library. are you sure you need it to build a shared library ?</description>
      <pubDate>Thu, 01 Jul 2004 12:32:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319990#M712198</guid>
      <dc:creator>ranganath ramachandra</dc:creator>
      <dc:date>2004-07-01T12:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319991#M712199</link>
      <description>The "warning 36" messages are because the instructions and register names are for a higher level than the default PA1.0.&lt;BR /&gt;You should have a ".LEVEL 2.0" directive in the file.&lt;BR /&gt;&lt;BR /&gt;The code looks very much like the output of "cc -S".  Perhaps you started from C code and intended to tweak the assembly language somehow.  If it was initially created that way you should just go back and use "cc +z -S" to create PIC instructions to start from.&lt;BR /&gt;&lt;BR /&gt;PIC code needs to refer to functions and global variables using relative branches and DLT table lookups.  That is discussed somewhat in the "HP Assembler Reference Manual" at&lt;BR /&gt;&lt;A href="http://www.docs.hp.com./hpux/dev/index.html#Assembler" target="_blank"&gt;http://www.docs.hp.com./hpux/dev/index.html#Assembler&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Jul 2004 13:16:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319991#M712199</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2004-07-01T13:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319992#M712200</link>
      <description>I overlooked that you were on 10.20.  That will only go as high as ".LEVEL 1.1".&lt;BR /&gt;&lt;BR /&gt;If there is no .c version of this pa-risc.s file, then you would need to rewrite many&lt;BR /&gt;instructions to create equivalent PIC code.</description>
      <pubDate>Thu, 01 Jul 2004 13:23:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319992#M712200</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2004-07-01T13:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319993#M712201</link>
      <description>Hi, Thanks to all,&lt;BR /&gt;First of all that code pa-risc.s along with openssl. I dont know how to write assembly code at all. I think openssl has its equivalant .c file, using that I ll try to produce new .s file. And yes i need to create shared library.&lt;BR /&gt;&lt;BR /&gt;I have one question,&lt;BR /&gt;basically i am trying to use assembly to enhance the performance of my shared library. Is it worth to convert the .c file to .s and then produce .o file and then use it to produce shared library.&lt;BR /&gt;&lt;BR /&gt;once again thanks a lot.</description>
      <pubDate>Fri, 02 Jul 2004 00:00:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319993#M712201</guid>
      <dc:creator>kishore_10</dc:creator>
      <dc:date>2004-07-02T00:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319994#M712202</link>
      <description>Hai,&lt;BR /&gt;&lt;BR /&gt; It is worth to create the .c file with debugging symbols (-g) and then using the ld command. Don't use the main() program in the in .c which is to be converted as shared library. If you want to do the postion independant,compile the  .c file with -WI,+nodefaultrpath flags. &lt;BR /&gt; &lt;BR /&gt; Use the steps as.,&lt;BR /&gt; &lt;BR /&gt;  cc -g -o &lt;OBJECTNAME&gt; *.c -WI,+nodefaultrpath&lt;BR /&gt;  some warnings will be come for using the .c file without main()&lt;BR /&gt;  ld -o -b &lt;LIBSSL.SO or="" libssl.sl=""&gt; &amp;lt;*.o&amp;gt;&lt;BR /&gt; &lt;BR /&gt; We can get the assembley information using the debugging symbols on gdb or wdb  with info assembley command. The step of changes will be decreased. Using the debugging symbols will be very good to debug the problem and all.&lt;BR /&gt; &lt;BR /&gt;Regards,&lt;BR /&gt;Muthukumar.&lt;/LIBSSL.SO&gt;&lt;/OBJECTNAME&gt;</description>
      <pubDate>Fri, 02 Jul 2004 00:50:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319994#M712202</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-07-02T00:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319995#M712203</link>
      <description>read the README ... :)&lt;BR /&gt;---&lt;BR /&gt;All assember in this directory are just version of the file crypto/bn/bn_mulw.c.&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;you just have to change the makefile to use this C file instead of the assembly source. just make sure you change the makefile to compile it with +z/+Z (if using cc/aCC) or -fpic/-fPIC (if using gcc).</description>
      <pubDate>Fri, 02 Jul 2004 03:31:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319995#M712203</guid>
      <dc:creator>ranganath ramachandra</dc:creator>
      <dc:date>2004-07-02T03:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319996#M712204</link>
      <description>ok i just saw the the top level Makefile itself lets you use the C code:&lt;BR /&gt;----&lt;BR /&gt;# Set BN_ASM to bn_asm.o if you want to use the C version&lt;BR /&gt;BN_ASM= bn_asm.o&lt;BR /&gt;----&lt;BR /&gt;i guess you have set it to&lt;BR /&gt;BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC&lt;BR /&gt;&lt;BR /&gt;i think using the C code is much better than using assembly because if you are building position independent code, the compiler can do a lot more optimization for that case. this is especially true if you dont know assembly :)</description>
      <pubDate>Fri, 02 Jul 2004 03:42:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319996#M712204</guid>
      <dc:creator>ranganath ramachandra</dc:creator>
      <dc:date>2004-07-02T03:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319997#M712205</link>
      <description>Hi ranganath,&lt;BR /&gt;First of all Thanks a lot for you support,&lt;BR /&gt;&lt;BR /&gt;As you thought, yes, I have changed the make file in order to use asm/pa-risc.s file (Not pa-risc2.s it is for RISC 2.0). &lt;BR /&gt;&lt;BR /&gt;From the replies i came to know that, pa-risc.s file not a PIC file. As Mike Stroyans adviced, I am trying to produce new pa-risc.s file from bn_asm.c file. Before that please tell me one thing, is it worth to do that. What i mean to say is, producing a pa-risc.o file using .c or from .s file which one is faster. (same thing i asked in my previous question.)&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Kishore</description>
      <pubDate>Fri, 02 Jul 2004 04:08:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319997#M712205</guid>
      <dc:creator>kishore_10</dc:creator>
      <dc:date>2004-07-02T04:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319998#M712206</link>
      <description>i dont think it makes a difference in execution. it may in fact be better to leave it as C code, because all optimizations will be dont prior to the assembler stage. the next time you want to build, you may be able to make use of the better optimization of a newer version of the compiler or another compiler altogether.</description>
      <pubDate>Fri, 02 Jul 2004 09:57:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319998#M712206</guid>
      <dc:creator>ranganath ramachandra</dc:creator>
      <dc:date>2004-07-02T09:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Position Independent Code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319999#M712207</link>
      <description>Just going through a .s file won't help performance.  You might improve performance if you rewrite that .s file using particular assembly language operations that the compiler is not using.  That is only likely if you are an expert with the assembly language and you know something about the code that can't be expressed in the C language.  The compiler might not know that parameters almost always have a few particular values or that some cases are exceptionally common.&lt;BR /&gt;  You can help the compiler with some of those details by using 'profile based optimization'.  That lets the compiler refer back to information recorded by previous runs of the code.  It is discussed in the optimization section of the 'C Programmer's Guide' at &lt;A href="http://www.docs.hp.com./hpux/onlinedocs/92434-90011/92434-90011.html" target="_blank"&gt;http://www.docs.hp.com./hpux/onlinedocs/92434-90011/92434-90011.html&lt;/A&gt;</description>
      <pubDate>Tue, 06 Jul 2004 10:22:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/position-independent-code/m-p/3319999#M712207</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2004-07-06T10:22:28Z</dc:date>
    </item>
  </channel>
</rss>

