From: Rafaël C. <fu...@vi...> - 2012-07-17 17:19:42
|
Hello, Le 2012-07-16 00:09, John Reiser a écrit : > Functions MC_put_o_16_arm, MC_put_o_8_arm, MC_put_x_16_arm, MC_put_x_8_arm > in libmpeg2/motion_comp_arm_s.S have addresses in .text, which is bad > for shared libraries. Some environments demand that .text actually be > read-only all the time, yet MC_put_o_16_arm etc require that the addresses > be modified by the dynamic linking mechanism (dlopen, LoadLibrary, etc.) > Even in those environments which permit the dynamic linker to modify the > .text segment, the runtime cost of doing the relocation can be noticeable. > > The attached patch rewrites the linkage, discarding the tables of addresses > in favor of tables of offsets. All transfers are local within each individual > function, so there can be no interference by processing that occurs > after assembly, such as link-time re-ordering (even of individual functions.) > > -- John Reiser > > > libmpeg2.patch > > > Index: libmpeg2/motion_comp_arm_s.S > =================================================================== > --- libmpeg2/motion_comp_arm_s.S (revision 1205) > +++ libmpeg2/motion_comp_arm_s.S (working copy) > @@ -29,9 +29,13 @@ > pld [r1] > stmfd sp!, {r4-r11, lr} @ R14 is also called LR > and r4, r1, #3 > - adr r5, MC_put_o_16_arm_align_jt > - add r5, r5, r4, lsl #2 > - ldr pc, [r5] > + ldrb r4, [pc, r4] > + add pc, pc, r4, lsl #2 Is this instruction available on all ARM variants? I have to ask because I found some restrictions on: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0068b/BABDCBAB.html Although here it should be the form "ADD Rd, Rn, #imm8m" which works everywhere. > + .byte (MC_put_o_16_arm_align0 - 0f)>>2 > + .byte (MC_put_o_16_arm_align1 - 0f)>>2 > + .byte (MC_put_o_16_arm_align2 - 0f)>>2 > + .byte (MC_put_o_16_arm_align3 - 0f)>>2 > +0: |