On Fri, 2012-02-03 at 21:37 -0200, EmÃlio Wuerges wrote:
Thanks for including it!
Btw, I'm planning in submit some a patch adding a call to dominator analysis.
Sounds interesting.
Is there any trick for the copyright? I have no problems with GPL.
The project doesn't have any copyright assignment requirement: you get
to keep copyright in any contributions you make, though AIUI there's an
implicit licensing of such contributions under the GPLv3 or later, given
that any contribution is a derived work of the plugin, which is itself
licensed under the GPLv3 or later. I'm not a lawyer, though.
The error without -fPIC is:
Stderr:
/usr/bin/ld: /tmp/ccnYvmYr.o: relocation R_X86_64_32 against
`.rodata.str1.1' can not be used when making a shared object;
recompile with -fPIC
/tmp/ccnYvmYr.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
And what I get in my system from python config is this:
$ python-config --cflags
-I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing
-g -O2 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes
$ python-config --ldflags
-L/usr/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7
-Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
$ python -c "from distutils import sysconfig as sc;
> print(sc.get_config_var('CFLAGS'))"
-fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes
ew@arrakis:~/gcc-python-plugin/gcc-python-plugin$
Its the default from ubuntu. I've not changed anything.
Thanks for the
information. It looks to me like those defaults are
broken: both the --cflags and CFLAGS ought to contain '-fPIC'
themselves. I'd argue that this is a bug in Ubuntu's python builds, but
in any case, we have the workaround for the missing -fPIC in our
Makefile now.
Do you still need to add the LD_PRELOAD thing you mentioned earlier? It
might be missing a "-shared" in the ldflags.
Hey, I have a question.
How do I create a pass that will run only once after "ira" pass?
Something like an SimpleIpaPass, but after "ira".
Any ideas?
When planning a new pass, I normally look at the "subway map"
here:
http://gcc-python-plugin.readthedocs.org/en/latest/tables-of-passes.html
I see there that "ira" pass happens during the "rest_of_compilation"
activities after the code is in RTL form.
My understanding is that all of those RTL passes are being done
per-function, rather than globally.
I'm not yet sure whether GCC does its passes like this:
for each function:
for each pass:
do pass on function
or like this:
for each pass:
for each function:
do pass on function
[Any gcc experts around?]
My reading of gcc/passes.c:execute_one_pass is that the work of each
pass is done via various do_per_function() calls. Looking there it
seems that rather than a gcc.Pass you could wire up a callback to the
gcc.PLUGIN_PASS_EXECUTION event. This is is called immediately before a
pass begins, so to hook in after "ira", perhaps your callback could take
action on the next pass, which seems to be "*all-postreload".
Alternatively, you could create a gcc.RtlPass that runs after the "ira"
pass, but only have it do anything the first time it's called.
Hope this is helpful
Dave