- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Position Independent Code
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2004 07:00 PM
тАО06-30-2004 07:00 PM
Position Independent Code
I am trying to compile "Openssl on HPUX 10.20"
# uname -a
HP-UX SIS B.10.20 A 9000/867 ........
There is a "pa-risc.s" file
I am trying to produce pa-risc.o file using following command.
# as +z pa-risc.s -o pa-risc.o
it is producing pa-risc.o file however with lot of warnings, some of the warning are...
as: "pa-risc.s", line 649: warning 36: Use of %fr10R is incorrect for the current LEVEL of 1.0
as: "pa-risc.s", line 649: warning 36: Use of XMPYU is incorrect for the current LEVEL of 1.0
as: "pa-risc.s", line 651: warning 36: Use of %fr9R is incorrect for the current LEVEL of 1.0
.......etc.
and when i build to produce shared library and i am getting following error
/usr/ccs/bin/ld: DP relative code in file libcrypto.a(pa-risc.o) - shared library must be position
independent. Use +z or +Z to recompile.
*** Error exit code 1
what is going wrong :(, my unix knowledge is very less, can any body help me?
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"
pa-risc.s file is attached with the message
please help me to solve this problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2004 05:32 AM
тАО07-01-2004 05:32 AM
Re: Position Independent Code
--
ranga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2004 06:16 AM
тАО07-01-2004 06:16 AM
Re: Position Independent Code
You should have a ".LEVEL 2.0" directive in the file.
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.
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
http://www.docs.hp.com./hpux/dev/index.html#Assembler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2004 06:23 AM
тАО07-01-2004 06:23 AM
Re: Position Independent Code
If there is no .c version of this pa-risc.s file, then you would need to rewrite many
instructions to create equivalent PIC code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2004 05:00 PM
тАО07-01-2004 05:00 PM
Re: Position Independent Code
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.
I have one question,
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.
once again thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2004 05:50 PM
тАО07-01-2004 05:50 PM
Re: Position Independent Code
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.
Use the steps as.,
cc -g -o
some warnings will be come for using the .c file without main()
ld -o -b
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.
Regards,
Muthukumar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2004 08:31 PM
тАО07-01-2004 08:31 PM
Re: Position Independent Code
---
All assember in this directory are just version of the file crypto/bn/bn_mulw.c.
---
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).
--
ranga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2004 08:42 PM
тАО07-01-2004 08:42 PM
Re: Position Independent Code
----
# Set BN_ASM to bn_asm.o if you want to use the C version
BN_ASM= bn_asm.o
----
i guess you have set it to
BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC
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 :)
--
ranga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2004 09:08 PM
тАО07-01-2004 09:08 PM
Re: Position Independent Code
First of all Thanks a lot for you support,
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).
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.)
regards,
Kishore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2004 02:57 AM
тАО07-02-2004 02:57 AM
Re: Position Independent Code
--
ranga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-06-2004 03:22 AM
тАО07-06-2004 03:22 AM
Re: Position Independent Code
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 http://www.docs.hp.com./hpux/onlinedocs/92434-90011/92434-90011.html
- Tags:
- PBO