ref: 2cc5c8f97c534ff5f1aedddcf5bc3267010e594e
parent: c13aaf7a3e245315d88245a710f89d14694bc56f
author: Martin Storsjo <[email protected]>
date: Wed Mar 21 10:09:04 EDT 2018
ads2gas: Add a -noelf option This allows skipping elf specific features from the output. Change-Id: I739299ba41286ca10415e056b4ffd561be5e0350
--- a/build/make/ads2gas.pl
+++ b/build/make/ads2gas.pl
@@ -23,9 +23,11 @@
use thumb;
my $thumb = 0;
+my $elf = 1;
foreach my $arg (@ARGV) {
$thumb = 1 if ($arg eq "-thumb");
+ $elf = 0 if ($arg eq "-noelf");
}
print "@ This file was created from a .asm file\n";
@@ -140,7 +142,11 @@
# Make function visible to linker, and make additional symbol with
# prepended underscore
- s/EXPORT\s+\|([\$\w]*)\|/.global $1 \n\t.type $1, function/;
+ if ($elf) {
+ s/EXPORT\s+\|([\$\w]*)\|/.global $1 \n\t.type $1, function/;
+ } else {
+ s/EXPORT\s+\|([\$\w]*)\|/.global $1/;
+ }
s/IMPORT\s+\|([\$\w]*)\|/.global $1/;
s/EXPORT\s+([\$\w]*)/.global $1/;
@@ -181,11 +187,16 @@
# eabi_attributes numerical equivalents can be found in the
# "ARM IHI 0045C" document.
- # REQUIRE8 Stack is required to be 8-byte aligned
- s/\sREQUIRE8/.eabi_attribute 24, 1 \@Tag_ABI_align_needed/g;
+ if ($elf) {
+ # REQUIRE8 Stack is required to be 8-byte aligned
+ s/\sREQUIRE8/.eabi_attribute 24, 1 \@Tag_ABI_align_needed/g;
- # PRESERVE8 Stack 8-byte align is preserved
- s/\sPRESERVE8/.eabi_attribute 25, 1 \@Tag_ABI_align_preserved/g;
+ # PRESERVE8 Stack 8-byte align is preserved
+ s/\sPRESERVE8/.eabi_attribute 25, 1 \@Tag_ABI_align_preserved/g;
+ } else {
+ s/\sREQUIRE8//;
+ s/\sPRESERVE8//;
+ }
# Use PROC and ENDP to give the symbols a .size directive.
# This makes them show up properly in debugging tools like gdb and valgrind.
@@ -202,7 +213,7 @@
my $proc;
s/\bENDP\b/@ $&/;
$proc = pop(@proc_stack);
- $_ = "\t.size $proc, .-$proc".$_ if ($proc);
+ $_ = "\t.size $proc, .-$proc".$_ if ($proc and $elf);
}
# EQU directive
@@ -225,4 +236,4 @@
}
# Mark that this object doesn't need an executable stack.
-printf ("\t.section\t.note.GNU-stack,\"\",\%\%progbits\n");
+printf ("\t.section\t.note.GNU-stack,\"\",\%\%progbits\n") if $elf;