Fix from upstream cvs: 2004-12-12 Dan Dennedy * *_x86_64.S: apply patch from Dean Kolosiek to fix linker compatibility. --- libdv-0.104/libdv/encode_x86_64.S +++ libdv-0.104/libdv/encode_x86_64.S @@ -47,7 +47,8 @@ mov $63, %rcx # loop counter - mov vlc_encode_lookup(%rip), %r11 + mov vlc_encode_lookup@GOTPCREL(%rip), %r11 + mov (%r11),%r11 pxor %mm0, %mm0 pxor %mm2, %mm2 @@ -129,7 +130,8 @@ add $2, %rdi /* skip the DC coefficient */ mov $63, %rcx - mov vlc_num_bits_lookup(%rip), %r11 + mov vlc_num_bits_lookup@GOTPCREL(%rip), %r11 + mov (%r11),%r11 vlc_num_bits_block_x86_loop: movw (%rdi), %ax /* get the next coeffiecient */ --- libdv-0.104/libdv/idct_block_mmx_x86_64.S +++ libdv-0.104/libdv/idct_block_mmx_x86_64.S @@ -22,7 +22,7 @@ /* void _dv_idct_88(dv_coeff_t *block) */ /* argument block=rdi */ - lea preSC(%rip), %r11 + mov preSC@GOTPCREL(%rip), %r11 /* * column 0: even part --- libdv-0.104/libdv/quant_x86_64.S +++ libdv-0.104/libdv/quant_x86_64.S @@ -73,10 +73,10 @@ /* pq = dv_quant_shifts[qno + dv_quant_offset[class]]; */ mov %rsi,%rax /* qno */ mov %rdx,%r12 /* class */ - lea dv_quant_offset(%rip),%rcx + mov dv_quant_offset@GOTPCREL(%rip),%rcx movzbq (%rcx,%r12,1),%rcx /* dv_quant_offset[class] */ add %rcx,%rax /* qno + */ - lea dv_quant_shifts(%rip),%r11 + mov dv_quant_shifts@GOTPCREL(%rip),%r11 lea (%r11,%rax,4),%r11 /* r11 is pq = dv_quant_shifts[...] */ /* extra = (class == 3); */ @@ -217,10 +217,10 @@ mov %rsi,%rax /* qno */ mov %rdx,%r12 /* class */ - lea dv_quant_offset(%rip),%rcx + mov dv_quant_offset@GOTPCREL(%rip),%rcx movzbq (%rcx,%r12,1),%rcx add %rcx,%rax - lea dv_quant_shifts(%rip),%r11 + mov dv_quant_shifts@GOTPCREL(%rip),%r11 lea (%r11,%rax,4),%r11 /* r11 is pq */ /* extra = (class == 3); */ --- libdv-0.104/libdv/vlc_x86_64.S +++ libdv-0.104/libdv/vlc_x86_64.S @@ -16,28 +16,28 @@ /* klass = dv_vlc_classes[maxbits][(bits & (dv_vlc_class_index_mask[maxbits])) >> */ /* (dv_vlc_class_index_rshift[maxbits])]; */ /* xor %rbp,%rbp */ - lea dv_vlc_class_index_mask(%rip),%r11 /* use %rip for PIC code */ + mov dv_vlc_class_index_mask@GOTPCREL(%rip),%r11 /* use %rip for PIC code */ mov (%r11,%rbx,4),%ebp /* int32 */ /* dv_vlc_class_index_mask[maxbits] */ and %eax,%ebp /* bits & */ - lea dv_vlc_class_index_rshift(%rip),%rcx + mov dv_vlc_class_index_rshift@GOTPCREL(%rip),%rcx mov (%rcx,%rbx,4),%ecx /* int32 */ /* dv_vlc_class_index_rshift[maxbits] */ sar %cl,%ebp /* >> */ - lea dv_vlc_classes(%rip),%rcx + mov dv_vlc_classes@GOTPCREL(%rip),%rcx mov (%rcx,%rbx,8),%rcx /* ptr */ /* dv_vlc_classes[maxbits], a pointer */ movsbq (%rcx,%rbp,1),%rbp /* int8 */ /* klass = */ /* *result = dv_vlc_lookups[klass][(bits & (dv_vlc_index_mask[klass])) >> */ /* (dv_vlc_index_rshift[klass])]; */ /* xor %rbx,%rbx */ - lea dv_vlc_index_mask(%rip),%r11 + mov dv_vlc_index_mask@GOTPCREL(%rip),%r11 mov (%r11,%rbp,4),%ebx /* int32 */ /* (dv_vlc_index_mask[klass]) */ /* xor %rcx,%rcx */ - lea dv_vlc_index_rshift(%rip),%r11 + mov dv_vlc_index_rshift@GOTPCREL(%rip),%r11 mov (%r11,%rbp,4),%ecx /* int32 */ /* dv_vlc_index_rshift[klass] */ and %eax,%ebx /* bits & */ sar %cl,%ebx /* >> */ - lea dv_vlc_lookups(%rip),%r11 + mov dv_vlc_lookups@GOTPCREL(%rip),%r11 mov (%r11,%rbp,8),%rbp /* ptr */ /* dv_vlc_lookups[klass] */ mov (%rbp,%rbx,4),%ebp /* int32 */ /* *result = */ @@ -57,7 +57,7 @@ mov %ebp,%ecx sar $8,%ecx and $0xff,%ecx /* result->len */ - lea sign_mask(%rip),%rbx + mov sign_mask@GOTPCREL(%rip),%rbx mov (%rbx,%rcx,4),%ebx /* int32 */ and %ebx,%eax neg %eax @@ -109,17 +109,17 @@ mov %rax,%rbp and $0xfe00,%ebp sar $9,%ebp - lea dv_vlc_class_lookup5(%rip),%r11 + mov dv_vlc_class_lookup5@GOTPCREL(%rip),%r11 movsbq (%r11,%rbp),%rbp /* int8 klass */ - lea dv_vlc_index_mask(%rip),%rbx + mov dv_vlc_index_mask@GOTPCREL(%rip),%rbx mov (%rbx,%rbp,4),%ebx /* int32 */ - lea dv_vlc_index_rshift(%rip),%rcx + mov dv_vlc_index_rshift@GOTPCREL(%rip),%rcx mov (%rcx,%rbp,4),%ecx /* int32 */ and %eax,%ebx sar %cl,%ebx /* %rbx is klass */ - lea dv_vlc_lookups(%rip),%r11 + mov dv_vlc_lookups@GOTPCREL(%rip),%r11 mov (%r11,%rbp,8),%rbp /* ptr */ mov (%rbp,%rbx,4),%ebp /* int32 */ @@ -138,7 +138,7 @@ mov %ebp,%ecx sar $8,%ecx and $0xff,%ecx - lea sign_mask(%rip),%r11 + mov sign_mask@GOTPCREL(%rip),%r11 mov (%r11,%rcx,4),%ecx /* int32 */ and %ecx,%eax neg %eax @@ -253,7 +253,7 @@ /* Attempt to use the shortcut first. If it hits, then this vlc term has been decoded. */ - lea dv_vlc_class1_shortcut(%rip),%r10 + mov dv_vlc_class1_shortcut@GOTPCREL(%rip),%r10 mov (%r10,%rcx,4),%r11d /* record32 dv_vlc_tab_t */ test $0x80,%r11d @@ -267,17 +267,17 @@ /* %rax is bits */ - lea dv_vlc_class_lookup5(%rip),%r10 + mov dv_vlc_class_lookup5@GOTPCREL(%rip),%r10 movsbq (%r10,%rcx,1),%rcx /* int8 */ /* xor %r12,%r12 */ - lea dv_vlc_index_mask(%rip),%r10 + mov dv_vlc_index_mask@GOTPCREL(%rip),%r10 mov (%r10,%rcx,4),%r12d /* int32 */ - lea dv_vlc_lookups(%rip),%r10 + mov dv_vlc_lookups@GOTPCREL(%rip),%r10 mov (%r10,%rcx,8),%r11 /* ptr->record32 */ - lea dv_vlc_index_rshift(%rip),%r10 + mov dv_vlc_index_rshift@GOTPCREL(%rip),%r10 mov (%r10,%rcx,4),%ecx /* int32 */ and %eax,%r12d @@ -303,7 +303,7 @@ mov %r11d,%ecx sar $8,%ecx and $0xff,%ecx - lea sign_mask(%rip),%r10 + mov sign_mask@GOTPCREL(%rip),%r10 mov (%r10,%rcx,4),%ecx /* int32 */ and %ecx,%eax neg %eax @@ -388,7 +388,8 @@ mov %r11,%rsi /* bits */ mov %rax,%rdi /* bits_left */ lea vlc(%rip),%rdx /* *vlc */ - call dv_decode_vlc + mov dv_decode_vlc@GOTPCREL(%rip),%r11 + call *%r11 pop %rdx pop %rsi pop %rdi @@ -473,7 +474,7 @@ movl %r11d,dv_macroblock_t_eob_count(%r13) /* int32 */ /* mb->i = (seg->i + dv_super_map_vertical[m]) % (seg->isPAL?12:10); */ - lea dv_super_map_vertical(%rip),%r11 + mov dv_super_map_vertical@GOTPCREL(%rip),%r11 movl (%r11,%rax,4),%r11d /* int32 */ /* xor %rcx,%rcx */ movl dv_videosegment_t_i(%r12),%ecx /* int32 */ @@ -493,7 +494,7 @@ movl %r11d,dv_macroblock_t_i(%r13) /* int32 */ /* mb->j = dv_super_map_horizontal[m]; */ - lea dv_super_map_horizontal(%rip),%r11 + mov dv_super_map_horizontal@GOTPCREL(%rip),%r11 movl (%r11,%rax,4),%r11d /* int32 */ movl %r11d,dv_macroblock_t_j(%r13) /* int32 */ @@ -546,7 +547,8 @@ /* bl->reorder = &dv_reorder[bl->dct_mode][1]; */ shl $6,%rax /* *64 */ - lea (dv_reorder+1)(%rip),%rcx + mov dv_reorder@GOTPCREL(%rip),%rcx + add $1,%rcx add %rcx,%rax mov %rax,dv_block_t_reorder(%r15) /* ptr */ @@ -557,13 +559,13 @@ /* bl->offset= mb_start + dv_parse_bit_start[b]; */ /* xor %rcx,%rcx */ movl mb_start(%rip),%ecx /* int32 */ - lea dv_parse_bit_start(%rip),%rax + mov dv_parse_bit_start@GOTPCREL(%rip),%rax mov (%rax,%r12,4),%eax /* int32 */ add %rcx,%rax movl %eax,dv_block_t_offset(%r15) /* int32 */ /* bl->end= mb_start + dv_parse_bit_end[b]; */ - lea dv_parse_bit_end(%rip),%rax + mov dv_parse_bit_end@GOTPCREL(%rip),%rax mov (%rax,%r12,4),%eax /* int32 */ add %ecx,%eax mov %eax,dv_block_t_end(%r15) /* int32 */ @@ -603,7 +605,8 @@ mov dv_videosegment_t_bs(%rdi),%rdi /* passed in rdi was seg, now passing seg->bs */ mov %r13,%rsi /* mb */ mov %r15,%rdx /* bl */ - call dv_parse_ac_coeffs_pass0 + mov dv_parse_ac_coeffs_pass0@GOTPCREL(%rip),%r11 + call *%r11 pop %rdi pop %rsi pop %rdx @@ -635,10 +638,12 @@ mov %rsi,%rax /* quality */ and $DV_QUALITY_AC_MASK,%rax cmp $DV_QUALITY_AC_2,%rax + + jne done + mov dv_parse_ac_coeffs@GOTPCREL(%rip),%r11 + jmp *%r11 - jz dv_parse_ac_coeffs - - mov $0,%rax +done: mov $0,%rax ret