[llvm-dev] where does jump table stores?

慕冬亮 via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 28 22:55:57 PST 2015


I got the following message from one paper called readactor:
> We found that the LLVM compiler only emits data in the
> executable .text section of x86 binaries when optimizing a
> switch-case statement. LLVM emits the basic block address
> corresponding to each switch-case in a table after the current
> function. As shown in the left part of Figure 6, the switch
> statement is then implemented as a load from this table and
> an indirect branch to the loaded address.

I am curious about why llvm puts this jump table(extrances of cases
for switch). I did the same test for gcc, I found gcc stores it in
rodata. I think rodata section is a good place for those structures to
stay.
If there is any misunderstanding, please inform me.
Thanks.

-- 
My best regards to you.

     No System Is Safe!
     mudongliang


More information about the llvm-dev mailing list