Re: Compiler support for erasure of sensitive data

2016-03-09 Thread Andres Tiraboschi
We are developing this feature for x86_64
I want to see which registers are being used by the current function
for returning a value or as arguments.
I traverse the rtl looking for clobbered registers, but I don't know
how to find which registers are arguments from the current function
and which are used for storing the return value. How do you suggest to
do this?

Thanks

2016-03-04 9:23 GMT-03:00 Segher Boessenkool :
> On Tue, Mar 01, 2016 at 10:27:00AM +0100, Richard Biener wrote:
>> > We were thinking on making a function attribute that ensures that non 
>> > necessary registers, or stack frames used by the function will be 
>> > correctly cleared before returning.
>> > We think in implementing for x86_64 as a first work.
>> > For this we are trying to modify the epilogue generation. Here we should 
>> > have the information of which registers this function used, and the size 
>> > of the stack frame to clean. The downside of this is that will be 
>> > architecture dependent.
>> > Do you think this is a good idea? Do you suggest something else?
>>
>> I think you can't avoid doing architecture specific changes here.
>> Note that on x86_64 you probably want to force
>> -maccumulate-outgoing-args
>> to avoid the use of push/pop and have the stack frame freeing fully in
>> the epilogue.
>
> You'll also need to disable shrink-wrapping for that function.
>
>
> Segher


Using stl containers in gcc

2016-05-03 Thread Andres Tiraboschi
Hi,
Does anyone know if there is a good reason for not using stl
containers in gcc sources?
I'm asking because I didn't find any use of them in the code I read.

Thanks, Andrés.


Re: Using stl containers in gcc

2016-05-03 Thread Andres Tiraboschi
This raises a further question: why are gcc containers preferred over stl ones.

Thanks, Andrés.

2016-05-03 12:02 GMT-03:00 Jakub Jelinek :
> On Tue, May 03, 2016 at 08:59:11AM -0600, Jeff Law wrote:
>> On 05/03/2016 08:44 AM, Andres Tiraboschi wrote:
>> >Hi,
>> >Does anyone know if there is a good reason for not using stl
>> >containers in gcc sources?
>> >I'm asking because I didn't find any use of them in the code I read.
>> The GCC coding conventions allow the use of the standard library; but you
>> have to be careful WRT objects that are subject to garbage collection.
>
> And, if there is a GCC counterpart of a particular container, the GCC
> counterpart should be used instead of the stl one.
> E.g. vec, or hash_map etc.
>
> Jakub


Modifying generic tree with a plugin

2014-09-04 Thread Andres Tiraboschi
Sombody knows if it is possible modifing the generic during
compilation with a plugin?


Inserting global variable daclaration

2014-09-22 Thread Andres Tiraboschi
Hi, I was trying to insert a global variable declaration using gcc plugins.
I tried to make simple plugin example that inserts a global int variable called
_fake_var_.
The plugin code is this:

 plugin.cpp --

int plugin_is_GPL_compatible;
static tree fake_var = NULL;

static void start_unit_callback (void *gcc_data, void *user_data)
{
printf("\n--Start Unit--\n");
  fake_var = build_decl (UNKNOWN_LOCATION, VAR_DECL,
 get_identifier ("_fake_var_"),
 integer_type_node);
  TREE_PUBLIC (fake_var) = 1;
  DECL_ARTIFICIAL (fake_var) = 1;
  TREE_USED(fake_var) = 1;
}

int plugin_init (struct plugin_name_args *plugin_info,
 struct plugin_gcc_version *version)
{
  register_callback ("start_unit", PLUGIN_START_UNIT,
&start_unit_callback, NULL);
  return 0;
}
--
Then i compiled the next code(test.c) using that plugin:

 test.c --

int main(void) {
_fake_var_=2;
return 0;
}
---

But i get this message:
error: ‘_fake_var_’ was not declared in this scope _fake_var_=2;

The question is that if I'm missing something here and if there is
something wrong, because i didn't find further documentation about how
to do this.

Andrés.