Section 3.10.4 of the Arm generic user guide (page 172) gives an example for using TBB, but the example uses Arm assembler. I would like to learn how to use TBB with gas, but can't seem to figure out how. How should I revise the example from the guide to implement a switch statement with gas instead of armasm?
ADR.W R0, BranchTable_Byte
TBB [R0, R1] ; R1 is the index, R0 is the base address of the
; branch table
Case1
; an instruction sequence follows
Case2
; an instruction sequence follows
Case3
; an instruction sequence follows
BranchTable_Byte
DCB 0 ; Case1 offset calculation
DCB ((Case2-Case1)/2) ; Case2 offset calculation
DCB ((Case3-Case1)/2) ; Case3 offset calculation
I'm new to using gas and am not sure if I should be defining the branch table in a .data section at the beginning of the assembler file or if it should go after my switch statement in the .text section.
something like this perhaps. Need colons on labels. ; is sadly not a comment anymore @ is, got lucky on the label math.