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

Nick Lewycky nicholas at mxc.ca
Wed Jun 18 23:50:22 PDT 2014


Tom Roeder wrote:
> 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.

I guess what I thought would happen is that you pass "-fcfi" to clang 
(or whatever frontend) and it marks everything jumptable unnamed_addr 
for you? ANd also adds the CFI pass to the pass manager?

Nick



More information about the llvm-commits mailing list