Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

linker - libc.a unexpected reloc type 0x03

I use a prebuild libc.a, which have some copy relocation :

0001f554  00010f03 R_ARM_REL32       0001fb00   __memcpy_neon
0001f558  00037803 R_ARM_REL32       00020000   __memcpy_vfp
0002100e  0000f303 R_ARM_REL32       0007aa78   __libc_multiple_thread
0002108e  0000f303 R_ARM_REL32       0007aa78   __libc_multiple_thread
0002110e  0000f303 R_ARM_REL32       0007aa78   __libc_multiple_thread
0003b810  0000f303 R_ARM_REL32       0007aa78   __libc_multiple_thread
0003b98e  0000f303 R_ARM_REL32       0007aa78   __libc_multiple_thread
0002b3a2  00006c03 R_ARM_REL32       00077998   __pointer_chk_guard_lo
00044334  00006c03 R_ARM_REL32       00077998   __pointer_chk_guard_lo

I want to statically link a shared library to this static libc.a :

arm-linux-gcc -fPIC -shared shared.c ./libc.a -o libshared.so

This works without any warning or error.

But when I execute an executable which dependends on this libshared I have this :

error while loading shared libraries: ./libshared.so: unexpected reloc type 0x03

So first, what do really mean R_ARM_REL32 and why gcc allow me to create this libshared without any error or warning ? It should be impossible to create a shared library from objects with some copy relocation.

Seconds, how can I solve my problem, do I have to rebuild libc.a with -fPIC flag ? Is there any other solution which allow me to not modify this libc.a ?

And which library implements these R_ARM_REL32 dependencies, why libc.a is not independent ?

question from:https://stackoverflow.com/questions/66064709/libc-a-unexpected-reloc-type-0x03

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...