5182befa49
This makes sure that labels for data symbols directly after functions get properly 4-byte-aligned (when the source is assembled in thumb mode). Previously, if declaring a data symbol directly after a function, the symbol could end up pointing to the unaligned address (if the total size of the thumb function didn't end up being a multiple of 4). The data in the symbol itself ended up aligned, but the symbol pointed to the preceding unaligned position. That is, a source file looking like this: --- ... ENDP symbol DCD 0x12345678 --- could end up being assembled into symbol: xxxxx2: 0000 xxxxx4: 5678 xxxxx6: 1234 (This doesn't happen if the symbol label is on the same line as the DCD directive.) By adding an ALIGN 4 directly after the ENDP we make sure the symbol itself gets aligned properly. This isn't an issue with the original, untranslated arm source, since it only is built in arm mode where all instructions are 4 byte, and since the gnu assembler automatically adds the padding before the symbol even in thumb mode. Change-Id: Iadbeebd656b0197e423e79a12a7d3ef8859cf445
40 lines
915 B
Perl
Executable File
40 lines
915 B
Perl
Executable File
#!/usr/bin/env perl
|
|
##
|
|
## Copyright (c) 2013 The WebM project authors. All Rights Reserved.
|
|
##
|
|
## Use of this source code is governed by a BSD-style license
|
|
## that can be found in the LICENSE file in the root of the source
|
|
## tree. An additional intellectual property rights grant can be found
|
|
## in the file PATENTS. All contributing project authors may
|
|
## be found in the AUTHORS file in the root of the source tree.
|
|
##
|
|
|
|
use FindBin;
|
|
use lib $FindBin::Bin;
|
|
use thumb;
|
|
|
|
print "; This file was created from a .asm file\n";
|
|
print "; using the ads2armasm_ms.pl script.\n";
|
|
|
|
while (<STDIN>)
|
|
{
|
|
undef $comment;
|
|
undef $line;
|
|
|
|
s/REQUIRE8//;
|
|
s/PRESERVE8//;
|
|
s/^\s*ARM\s*$//;
|
|
s/AREA\s+\|\|(.*)\|\|/AREA |$1|/;
|
|
s/qsubaddx/qsax/i;
|
|
s/qaddsubx/qasx/i;
|
|
|
|
thumb::FixThumbInstructions($_, 1);
|
|
|
|
s/ldrneb/ldrbne/i;
|
|
s/ldrneh/ldrhne/i;
|
|
s/(ENDP.*)/$&\n ALIGN 4/;
|
|
|
|
print;
|
|
}
|
|
|