[PATCH] Add an option to allow JumpInstrTables to set unnamed_addr and jumptable on all address-taken functions

Tom Roeder tmroeder at google.com
Wed Jun 18 09:15:43 PDT 2014


On Wed, Jun 18, 2014 at 12:00 AM, Nick Lewycky <nicholas at mxc.ca> wrote:
> Tom Roeder wrote:
>>
>> This small patch adds a new command flag -jump-table-all and an associated
>> TargetOptions field JumpTableAll, and it modifies JumpInstrTables to add
>> unnamed_addr and jumptable to all address-taken functions if the flag is
>> set.
>>
>> This is important for applications like my implementation of control-flow
>> integrity, which want to operate over all address-taken functions and not
>> just the ones that happened to have been marked jumptable.
>
>
> Why aren't all functions being marked jumptable when building with CFI?

The CFI pass has to operate after the jumptable pass so it has the
requisite information (all the transformations performed by
JumpInstrTable). If I want to mark all functions jumptable, then I
have to do it before JumpInstrTable runs, or during. So, there has to
be something separate from the CFI pass itself that makes this happen.
I could add a separate pass, or I could make JumpInstrTables know
about CFI and set everything as jumptable when it sees CFI requested.
I thought instead it made sense to have this as a feature of
JumpInstrTables itself.



More information about the llvm-commits mailing list