Created
September 30, 2011 06:04
-
-
Save 2bits/1252827 to your computer and use it in GitHub Desktop.
flac-1.2.1/src/libFLAC/ia32/bitreader_asm.nasm Fixes illegal text reloc for elf in asm code, from Richard Ash Audacity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Doesn't work yet for macho | |
--- src/libFLAC/ia32/bitreader_asm.nasm.orig 2007-03-29 17:54:53.000000000 -0700 | |
+++ src/libFLAC/ia32/bitreader_asm.nasm 2011-09-29 23:51:01.000000000 -0700 | |
@@ -138,10 +138,20 @@ | |
mov ecx, [ebp + 28] ; ecx <- br->crc16_align | |
mov eax, [ebp + 24] ; ax <- br->read_crc (a.k.a. crc) | |
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE | |
+%ifdef OBJ_FORMAT_macho | |
+ mov edi, [esp + 16] ; saved ebx (GOT base) | |
+ lea edi, [edi + _FLAC__crc16_table wrt ..gotoff] | |
+%else | |
mov edi, _FLAC__crc16_table | |
+%endif | |
+%else | |
+%ifdef OBJ_FORMAT_elf | |
+ mov edi, [esp + 16] ; saved ebx (GOT base) | |
+ lea edi, [edi + FLAC__crc16_table wrt ..gotoff] | |
%else | |
mov edi, FLAC__crc16_table | |
%endif | |
+%endif | |
;; eax (ax) crc a.k.a. br->read_crc | |
;; ebx (bl) intermediate result index into FLAC__crc16_table[] | |
;; ecx br->crc16_align | |
@@ -214,10 +224,20 @@ | |
mov ecx, [ebp + 28] ; ecx <- br->crc16_align | |
mov eax, [ebp + 24] ; ax <- br->read_crc (a.k.a. crc) | |
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE | |
+%ifdef OBJ_FORMAT_macho | |
+ mov edi, [esp + 16] ; saved ebx (GOT base) | |
+ lea edi, [edi + _FLAC__crc16_table wrt ..gotoff] | |
+%else | |
mov edi, _FLAC__crc16_table | |
+%endif | |
+%else | |
+%ifdef OBJ_FORMAT_elf | |
+ mov edi, [esp + 16] ; saved ebx (GOT base) | |
+ lea edi, [edi + FLAC__crc16_table wrt ..gotoff] | |
%else | |
mov edi, FLAC__crc16_table | |
%endif | |
+%endif | |
;; eax (ax) crc a.k.a. br->read_crc | |
;; ebx (bl) intermediate result index into FLAC__crc16_table[] | |
;; ecx br->crc16_align | |
@@ -313,10 +333,20 @@ | |
push ecx ; /* save */ | |
push ebp ; /* push br argument */ | |
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE | |
+%ifdef OBJ_FORMAT_macho | |
+ mov ebx, [esp + 20] ; saved ebx (GOT base) | |
+ call _bitreader_read_from_client_ wrt ..plt | |
+%else | |
call _bitreader_read_from_client_ | |
+%endif | |
+%else | |
+%ifdef OBJ_FORMAT_elf | |
+ mov ebx, [esp + 20] ; saved ebx (GOT base) | |
+ call bitreader_read_from_client_ wrt ..plt | |
%else | |
call bitreader_read_from_client_ | |
%endif | |
+%endif | |
pop edx ; /* discard, unused */ | |
pop ecx ; /* restore */ | |
mov esi, [ebp + 16] ; cwords = br->consumed_words; | |
@@ -362,13 +392,25 @@ | |
mov [ebp + 16], esi ; br->consumed_words = cwords; | |
mov [ebp + 20], ecx ; br->consumed_bits = cbits; | |
push ecx ; /* save */ | |
+ push ebx ; /* save */ | |
push ebp ; /* push br argument */ | |
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE | |
+%ifdef OBJ_FORMAT_macho | |
+ mov ebx, [esp + 24] ; saved ebx (GOT base) | |
+ call _bitreader_read_from_client_ wrt ..plt | |
+%else | |
call _bitreader_read_from_client_ | |
+%endif | |
+%else | |
+%ifdef OBJ_FORMAT_elf | |
+ mov ebx, [esp + 24] ; saved ebx (GOT base) | |
+ call bitreader_read_from_client_ wrt ..plt | |
%else | |
call bitreader_read_from_client_ | |
%endif | |
+%endif | |
pop edx ; /* discard, unused */ | |
+ pop ebx ; /* restore */ | |
pop ecx ; /* restore */ | |
mov esi, [ebp + 16] ; cwords = br->consumed_words; | |
; ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits; | |
@@ -435,10 +477,20 @@ | |
mov ecx, [ebp + 28] ; ecx <- br->crc16_align | |
mov eax, [ebp + 24] ; ax <- br->read_crc (a.k.a. crc) | |
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE | |
+%ifdef OBJ_FORMAT_macho | |
+ mov edi, [esp + 24] ; saved ebx (GOT base) | |
+ lea edi, [edi + _FLAC__crc16_table wrt ..gotoff] | |
+%else | |
mov edi, _FLAC__crc16_table | |
+%endif | |
+%else | |
+%ifdef OBJ_FORMAT_elf | |
+ mov edi, [esp + 24] ; saved ebx (GOT base) | |
+ lea edi, [edi + FLAC__crc16_table wrt ..gotoff] | |
%else | |
mov edi, FLAC__crc16_table | |
%endif | |
+%endif | |
;; eax (ax) crc a.k.a. br->read_crc | |
;; ebx (bl) intermediate result index into FLAC__crc16_table[] | |
;; ecx br->crc16_align |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment