From: Martin Storsjo Date: Wed, 19 Mar 2014 14:18:44 +0000 (+0200) Subject: ads2armasm_ms: Add an ALIGN 4 after ENDP X-Git-Tag: v1.4.0~2028^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5182befa492f4d1cf7e3c7b278cdeb85170abc9c;p=libvpx ads2armasm_ms: Add an ALIGN 4 after ENDP 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 --- diff --git a/build/make/ads2armasm_ms.pl b/build/make/ads2armasm_ms.pl index 95c808403..61ffe8869 100755 --- a/build/make/ads2armasm_ms.pl +++ b/build/make/ads2armasm_ms.pl @@ -32,6 +32,7 @@ while () s/ldrneb/ldrbne/i; s/ldrneh/ldrhne/i; + s/(ENDP.*)/$&\n ALIGN 4/; print; }