Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Integrity Servers: HP aC++/HP ANSI C Release Notes > Chapter 5 Known Problems and Workarounds

GPREL22 Relocation Error

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

If a variable is declared as extern non-array in one module and then defined as an array in another, a linker error may occur:

Definition: foo.c:uint64_t variable[SIZE];
Reference: bar.c:extern uint64_t variable;

ld: The value 0xXXX does not fit when applying the relocation GPREL22 for
symbol "variable" at offset 0xYYY in section index ZZZ of file bar.o.

Workaround: The declaration should be changed to:

extern uint64_t variable[];

This error can also occur in assembly code if items <= 8 bytes are put into.data/.bss instead of .sdata/.sbss.

Workaround (assembler): For "small" variables defined in assembly, change the section name from .bss to .sbss or .data to .sdata:

.section .sdata = "asw", "progbits" 
       .align 8
gggggggg::     data4   0x000003e7
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.