pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/51304: luatex suffers from luajit generating non-PIC code



>Number:         51304
>Category:       pkg
>Synopsis:       luatex suffers from luajit generating non-PIC code
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 03 07:00:00 +0000 2016
>Originator:     Richard PALO
>Release:        current
>Organization:
>Environment:
SunOS omnis 5.11 omnios-master-7397b49 i86pc i386 i86pc

>Description:
As initially reported in pkgsrc-users@

Seems luajit is reactivated, and one of its assembler files generated (lj_vm_asm.S) destined to be put in a shared library is non-PIC.

Looks like gnu-ld is tolerant of R_*_PC32 relocations here, but sun-ld wants R_*_PLT32 else it balks with:
> ...
> Text relocation remains                 	referenced
>     against symbol		    offset	in file
> lj_gc_step                          0x30b8    	.libs/lj_vm_asm.o
> lj_tab_len                          0x503     	.libs/lj_vm_asm.o
> lj_tab_getinth                      0x1c5d    	.libs/lj_vm_asm.o
> lj_tab_getinth                      0x2286    	.libs/lj_vm_asm.o
> lj_state_growstack                  0x1328    	.libs/lj_vm_asm.o
> lj_state_growstack                  0x194d    	.libs/lj_vm_asm.o
> lj_state_growstack                  0x19cc    	.libs/lj_vm_asm.o
> lj_state_growstack                  0x2470    	.libs/lj_vm_asm.o
> lj_state_growstack                  0x257e    	.libs/lj_vm_asm.o
> lj_state_growstack                  0x3093    	.libs/lj_vm_asm.o
> lj_ffh_coroutine_wrap_err           0x256f    	.libs/lj_vm_asm.o
> lj_str_new                          0x2b3a    	.libs/lj_vm_asm.o
> lj_tab_new                          0xb37     	.libs/lj_vm_asm.o
> lj_tab_setinth                      0x1d4c    	.libs/lj_vm_asm.o
> lj_tab_get                          0x20c3    	.libs/lj_vm_asm.o
> lj_err_throw                        0x337b    	.libs/lj_vm_asm.o
> lj_meta_tget                        0x1c12    	.libs/lj_vm_asm.o
> lj_meta_tset                        0x1cde    	.libs/lj_vm_asm.o
> lj_meta_equal                       0x1de0    	.libs/lj_vm_asm.o
> lj_meta_comp                        0x1d80    	.libs/lj_vm_asm.o
> lj_meta_cat                         0x88b     	.libs/lj_vm_asm.o
> lj_tab_next                         0x2193    	.libs/lj_vm_asm.o
> lj_buf_putstr_reverse               0x2c36    	.libs/lj_vm_asm.o
> lj_buf_putstr_lower                 0x2c88    	.libs/lj_vm_asm.o
> lj_buf_putstr_upper                 0x2cda    	.libs/lj_vm_asm.o
> lj_buf_tostr                        0x2c3d    	.libs/lj_vm_asm.o
> lj_buf_tostr                        0x2c8f    	.libs/lj_vm_asm.o
> lj_buf_tostr                        0x2ce1    	.libs/lj_vm_asm.o
> lj_ccallback_enter                  0x3611    	.libs/lj_vm_asm.o
> lj_ccallback_leave                  0x3659    	.libs/lj_vm_asm.o
> lj_dispatch_ins                     0x311f    	.libs/lj_vm_asm.o
> lj_dispatch_call                    0x3195    	.libs/lj_vm_asm.o
> lj_trace_hot                        0x316f    	.libs/lj_vm_asm.o
> lj_dispatch_stitch                  0x323a    	.libs/lj_vm_asm.o
> lj_dispatch_profile                 0x325e    	.libs/lj_vm_asm.o
> lj_func_closeuv                     0xaa3     	.libs/lj_vm_asm.o
> lj_func_newL_gc                     0xada     	.libs/lj_vm_asm.o
> lj_gc_step_fixtop                   0xb68     	.libs/lj_vm_asm.o
> lj_gc_step_fixtop                   0xbbd     	.libs/lj_vm_asm.o
> lj_gc_barrieruv                     0x9ef     	.libs/lj_vm_asm.o
> lj_gc_barrieruv                     0xa3d     	.libs/lj_vm_asm.o
> lj_strfmt_num                       0x2153    	.libs/lj_vm_asm.o
> lj_tab_dup                          0xb93     	.libs/lj_vm_asm.o
> lj_tab_newkey                       0xf0e     	.libs/lj_vm_asm.o
> lj_meta_arith                       0x1e68    	.libs/lj_vm_asm.o
> lj_meta_len                         0x1e9c    	.libs/lj_vm_asm.o
> lj_meta_equal_cd                    0x1dfa    	.libs/lj_vm_asm.o
> lj_meta_istype                      0x1e1b    	.libs/lj_vm_asm.o
> lj_meta_call                        0x1edc    	.libs/lj_vm_asm.o
> lj_meta_for                         0x1f1f    	.libs/lj_vm_asm.o
> lj_tab_reasize                      0x1022    	.libs/lj_vm_asm.o
> lj_trace_exit                       0x32f8    	.libs/lj_vm_asm.o
> lj_wrap_log                         0x2697    	.libs/lj_vm_asm.o
> lj_wrap_log10                       0x26c1    	.libs/lj_vm_asm.o
> lj_wrap_exp                         0x26eb    	.libs/lj_vm_asm.o
> lj_wrap_sin                         0x2715    	.libs/lj_vm_asm.o
> lj_wrap_cos                         0x273f    	.libs/lj_vm_asm.o
> lj_wrap_tan                         0x2769    	.libs/lj_vm_asm.o
> lj_wrap_asin                        0x2793    	.libs/lj_vm_asm.o
> lj_wrap_acos                        0x27bd    	.libs/lj_vm_asm.o
> lj_wrap_atan                        0x27e7    	.libs/lj_vm_asm.o
> lj_wrap_sinh                        0x2811    	.libs/lj_vm_asm.o
> lj_wrap_cosh                        0x283b    	.libs/lj_vm_asm.o
> lj_wrap_tanh                        0x2865    	.libs/lj_vm_asm.o
> lj_wrap_atan2                       0x28e3    	.libs/lj_vm_asm.o
> lj_wrap_pow                         0x84b     	.libs/lj_vm_asm.o
> lj_wrap_pow                         0x28a4    	.libs/lj_vm_asm.o
> lj_wrap_fmod                        0x2922    	.libs/lj_vm_asm.o
> ld: fatal: relocations remain against allocatable but non-writable sections
> collect2: error: ld returned 1 exit status
> gmake[2]: *** [Makefile:973: libtexluajit.la] Error 1

>How-To-Repeat:

>Fix:
This should be fixed correctly upstream, but a temporary workaround in pkgsrc may be the following patch:

richard@omnis:/home/richard/src/pkgsrc/print/luatex$ cat patches/patch-libs_luajit_Makefile.in 
$NetBSD$
Ensure that the luajit generated asm file is PIC for libtool use, particularly
important when linking under SunOS... appending @PLT seems to workaround the
issue with generated PC relative calls.

--- libs/luajit/Makefile.in.orig	2016-03-21 20:37:55.000000000 +0000
+++ libs/luajit/Makefile.in
@@ -1827,6 +1827,7 @@ lj_folddef.h: native/buildvm-stamp
 
 lj_vm_obj.o lj_vm_asm.S: native/buildvm-stamp
 	$(AM_V_GEN)native/buildvm -m $(LJVM_MODE) -o $@
+	test lj_vm_asm.S && $(SED) -i.orig 's/\(call lj_.*\)$$/\1@PLT/' lj_vm_asm.S
 
 lj_vm_obj.lo: lj_vm_obj.o lib_base.lo
 	$(AM_V_GEN)sed 's/lib_base/lj_vm_obj/' lib_base.lo >$@ \


BTW I needed to add 'gsed' to USE_TOOLS in order to use the simplified
inplace option to sed which nbsed doesn't support.



Home | Main Index | Thread Index | Old Index