Discussion:
Linker error "relocati,on truncated to fit"
(too old to reply)
Ole Streicher
2017-06-13 08:00:02 UTC
Permalink
Hi,

I am slowly re-starting the packaging of IRAF (still not officially
announced yet). When porting to s390x, I however run into a strange
error: IRAF needs a small piece of assembler code (kind-of longjump for
Fortan), which John Long gratefully ported to s390x two years ago:

zsvjmp_:
stg %r3,0(0,%r2)
xc 0(8,%r3),0(%r3)
xgr %r3,%r3
aghi %r2,8
j ***@PLT

(Copyright John Long, MIT license).

However, when I try to link that (statically), I get the following error:

zsvjmp.s:16:(.text+0x16): relocation truncated to fit: R_390_PLT16DBL
against symbol `__sigsetjmp@@GLIBC_2.2' defined in .text section in
/lib/s390x-linux-gnu/libc.so.6
collect2: error: ld returned 1 exit status

As an uneducated guess, I removed the "@PLT", but then I get a complaint
about that this is missing.

Compiler (assembler) is gcc-6.3, with the current (sid) binutils. About
three years ago (when John wrote that code), this problem didn't happen.

Could anyone help me here what is wrong with that assembler?

Best regards

Ole
Bastian Blank
2017-06-13 17:40:01 UTC
Permalink
Post by Ole Streicher
I am slowly re-starting the packaging of IRAF (still not officially
announced yet). When porting to s390x, I however run into a strange
error: IRAF needs a small piece of assembler code (kind-of longjump for
Is IRAF the stuff from http://iraf.noao.edu/ and last released five
years ago?
Post by Ole Streicher
stg %r3,0(0,%r2)
xc 0(8,%r3),0(%r3)
xgr %r3,%r3
aghi %r2,8
Looks like it is, but why do you want this jump via the PLT, while all
other variants do not?

| ./unix/as.linux/zsvjmp.s: jmp __sigsetjmp # let sigsetjmp do the rest
| ./unix/as.linux64/zsvjmp_c:asm(" jmp __sigsetjmp # let sigsetjmp do the rest");
Post by Ole Streicher
Could anyone help me here what is wrong with that assembler?
To make this work, you need to build with -fPIC.

Bastian
--
Earth -- mother of the most beautiful women in the universe.
-- Apollo, "Who Mourns for Adonais?" stardate 3468.1
Ole Streicher
2017-06-14 09:10:01 UTC
Permalink
Hi,

(Could I ask to get a CC of answers via mail? I am not subscribed to
this list.)

Thank you for your response!
Post by Bastian Blank
Post by Ole Streicher
I am slowly re-starting the packaging of IRAF (still not officially
announced yet). When porting to s390x, I however run into a strange
error: IRAF needs a small piece of assembler code (kind-of longjump for
Is IRAF the stuff from http://iraf.noao.edu/ and last released five
years ago?
Yes. I could convince upstream to put it into a git repository,
<https://github.com/iraf/iraf-v216> and now I am creating pull requests
to get it more Debian friendly: portability, build from the tarball,
removal of oddly licensed code. To port zsvjmp, I created a small
project three years ago: <https://github.com/olebole/zsvjmp>.
Post by Bastian Blank
Post by Ole Streicher
zsvjmp_: [...]
Looks like it is, but why do you want this jump via the PLT, while all
other variants do not?
| ./unix/as.linux/zsvjmp.s: jmp __sigsetjmp # let sigsetjmp do the rest
| ./unix/as.linux64/zsvjmp_c:asm(" jmp __sigsetjmp # let sigsetjmp do the rest");
That is way outdated. At least for x86_64, I need the @PLT now to avoid
linker errors. From my (very limited) understanding, @PLT would be
correct, since sigsetjmp resides in a shared lib (libc).
Post by Bastian Blank
Post by Ole Streicher
Could anyone help me here what is wrong with that assembler?
To make this work, you need to build with -fPIC.
This didn't help, I still get the same error message. Since zsvjmp.o
will be statically linked (yet), I also don't see why -fPIC would be needed.
Post by Bastian Blank
From browsing the S390 mnemonic list, I tried to replace the "j" opcode
with a "jg", and then the compilation succeeds. However, this is a very
wild guess, since the menmonic list just in both cases said it were a
"jump". Can you (or someone) confirm that "jg" is correct here? The code
still does not work, and I want to be sure that "jg" is not causing this.

Best regards

Ole

Loading...