ARM: kprobes-test: Workaround GAS .align bug

By default if no fill symbol is given to .align directive in a code
section it fills gap with NOPs. If previous fragment is not
instruction-aligned, additional pre-alignment is done by zero bytes
before NOPs. These zero bytes are marked as data by special symbol $d in
symbol table. Unfortunately GAS assumes that there is only code in the
code section so it "puts back" code symbol $a at the end of this
pre-alignment. So if there is some data after alignment it will be
interpreted as code and will be swapped back to LE for BE8 system during
a final linking.

If explicit fill value is given to .align, the NOP-padding code is
skipped and symbol table does not get messed-up.

So the workaround for this issue:
Use explicit fill value if data should be aligned in the code section.

Acked-by: Ben Dooks <ben.dooks@codethink.co.uk>
Acked-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
This commit is contained in:
Taras Kondratiuk 2013-11-08 18:29:29 +00:00 committed by Taras Kondratiuk
parent 3b86ee7a69
commit 41b5368f31
2 changed files with 2 additions and 2 deletions

View File

@ -113,7 +113,7 @@
* @ start of inline data... * @ start of inline data...
* .ascii "mov r0, r7" @ text title for test case * .ascii "mov r0, r7" @ text title for test case
* .byte 0 * .byte 0
* .align 2 * .align 2, 0
* *
* @ TEST_ARG_REG * @ TEST_ARG_REG
* .byte ARG_TYPE_REG * .byte ARG_TYPE_REG

View File

@ -115,7 +115,7 @@ struct test_arg_end {
/* multiple strings to be concatenated. */ \ /* multiple strings to be concatenated. */ \
".ascii "#title" \n\t" \ ".ascii "#title" \n\t" \
".byte 0 \n\t" \ ".byte 0 \n\t" \
".align 2 \n\t" ".align 2, 0 \n\t"
#define TEST_ARG_REG(reg, val) \ #define TEST_ARG_REG(reg, val) \
".byte "__stringify(ARG_TYPE_REG)" \n\t" \ ".byte "__stringify(ARG_TYPE_REG)" \n\t" \