Makes sure all local function symbols are declared as .thumb_func
even if they are not directly called. fft4|65536_neon in
libavcodec/arm/fft_neon.S are only accessed through saved offset in
a table for example. Fixes fate-mdct-4 tests in libav on iOS.
---
 gas-preprocessor.pl | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 2072ca3..834b28d 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -50,6 +50,7 @@ if ((grep /^-c$/, @gcc_cmd) && !(grep /^-o/, @gcc_cmd)) {
 
 my $comm;
 my $aarch64 = 0;
+my $thumb = 0;
 
 # detect architecture from gcc binary name
 if      ($gcc_cmd[0] =~ /arm64|aarch64/) {
@@ -118,9 +119,11 @@ while (<ASMFILE>) {
     # remove all comments (to avoid interfering with evaluating directives)
     s/(?<!\\)$comm.*//x;
 
+    $thumb = 1 if /\.code\s+16|\.thumb/;
+    $thumb = 0 if /\.code\s+32|\.arm/;
+
     # comment out unsupported directives
     s/\.type/$comm$&/x;
-    s/\.func/$comm$&/x;
     s/\.endfunc/$comm$&/x;
     s/\.ltorg/$comm$&/x;
     s/\.size/$comm$&/x;
@@ -128,6 +131,13 @@ while (<ASMFILE>) {
     s/\.arch/$comm$&/x;
     s/\.object_arch/$comm$&/x;
 
+    # recycle the '.func' directive for '.thumb_func' otherwise comment it out
+    if ($thumb) {
+        s/\.func/.thumb_func/x;
+    } else {
+        s/\.func/$comm$&/x;
+    }
+
     # the syntax for these is a little different
     s/\.global/.globl/x;
     # also catch .section .rodata since the equivalent to .const_data is 
.section __DATA,__const
@@ -410,8 +420,6 @@ my @rept_lines;
 my %literal_labels;     # for ldr <reg>, =<expr>
 my $literal_num = 0;
 
-my $thumb = 0;
-
 my %thumb_labels;
 my %call_targets;
 
@@ -436,9 +444,6 @@ foreach my $line (@pass1_lines) {
         push(@sections, $line);
     }
 
-    $thumb = 1 if $line =~ /\.code\s+16|\.thumb/;
-    $thumb = 0 if $line =~ /\.code\s+32|\.arm/;
-
     # handle ldr <reg>, =<expr>
     if ($line =~ /(.*)\s*ldr([\w\s\d]+)\s*,\s*=(.*)/) {
         my $label = $literal_labels{$3};
-- 
1.8.5.3

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to