Operating System - Linux
1752781 Members
6650 Online
108789 Solutions
New Discussion юеВ

Re: "Linker Error - relocation does not fit" on HP-UX 11.23 ia64

 

"Linker Error - relocation does not fit" on HPUX 11.23 ia64

I'm compiling and linking our code on HP 11.23(IA64) and encountered the below error.

aCC: HP aC++/ANSI C B3910B A.05.50 [May 15 2003]

ld: The value 0xe000000000209680 does not fit when applying the relocation GPREL22 for symbol "std::string::npos" at offset 0xb1 in section index 1254 of file /build/vendor/SourcePro7/lib/HPUX11.23IA64/aCC5.50/libtls78HPUX1123IA64OPT_NtvSTL_NoThr_64bit_s.a[cregex.o]

There are several binaries that are built from this code base. And one of them is getting this linker error. Rest of the binaries that are compiled and linked with same compile and link flags have no issues. They even link to the same set of libraries as this one where linking is failing.

Any ideas?
-thanks
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: "Linker Error - relocation does not fit" on HPUX 11.23 ia64

Shalom,

I think it falls into the following little matrix.

1) The code may be bad, which is most likely but you don't believe it.
2) There may be a linker bug. Check the patch/firmware database at http://itrc.hp.com and see if there are patches. There probably are based on the age of this compiler.
3) If you are in a hurry, you may wish to try linkinng on another system.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: "Linker Error - relocation does not fit" on HP-UX 11.23 ia64

As Steven mentioned A.05.50 is pretty old. The current compiler is A.06.10.

As documented, the problem could be due to the misuse of the +Oshortdata= option, if you specify a value too large.

But I seriously doubt the code is bad. Fixups are usually linker or compiler or option problems. But in this case, nobody should have any business taking the address or load value of npos. It is a constant -1. Unless the address is taken, or code like the following is used, the current compiler shouldn't access that location.
std::max(len, std::string::npos);

Re: "Linker Error - relocation does not fit" on HPUX 11.23 ia64

Hi,

Thanks for the response. I'm trying to upgrade the compiler the latest version now and see if that helps.

-thanks
Dennis Handly
Acclaimed Contributor

Re: "Linker Error - relocation does not fit" on HP-UX 11.23 ia64

>I'm trying to upgrade the compiler the latest version now and see if that helps.

I would first check for the +Oshortdata option.

Re: "Linker Error - relocation does not fit" on HPUX 11.23 ia64

Hi,

We do not use the +Oshortdata option. Interestingly(or unfortunaltely), compiler upgrade seems to have made things bad. Now, none of executables are linking properly and I get duplicate symbol error for "main()".

"ld: Duplicate symbol "main" "

Any help appreciated.

thanks

Dennis Handly
Acclaimed Contributor

Re: "Linker Error - relocation does not fit" on HP-UX 11.23 ia64

>I get duplicate symbol error for "main()".

What are the two object files? You can also link with -Wl,-ymain to show you them.