: New feature! MozillaWiki is now mobile-friendly. Visit from a mobile device to see new mobile theme + try editing. Release details.


From MozillaWiki
Jump to: navigation, search


This is a virtual machine with everything needed to run and develop pork. Pork is Mozilla's branch of oink with additional tools for code analysis and patching.

VMWare virtual machine (requires WS6 or Fusion): http://people.mozilla.org/~tglek/pork.vmwarevm.tar.gz

To install the tools on your regular machine, follow Static Analysis/Installing the Oink Stack


root password: rootroot

Username: pork User Pass: pork


  • Centos5 (rhel5 clone)
  • gcc3.4.6 which can compile and link(!) mozilla truck successfully.
  • MCPP preprocessor: integrates into gcc3.4. This isn't the most recent trunk version because that has some issues processing Mozilla. This version also has a bug that causes a single macro-expansion to be annotated incorrectly, but that's easy to workaround. Source is in ~/mcpp.old, installed version is somewhere in the /usr within gcc guts
  • pork stack: this isn't renamed correctly yet. See ~/oink-stack/oink
  • pork-barrel: in ~/pork-barrel lives a tool that provides "make -j"-like functionality for patch-writing tools(dehydra, squash, outparamdel, prboolcheck)
  • cvs checkout of mozilla in ~/mozilla with a provided .mozconfig.

Building Mozilla

For pork to work Mozilla must be compile with gcc3.4 because elsa currently does not handle system headers used by newer versions of gcc. Additionally if you want to use a patch tool, mcpp must be used since it provides information on how deal with macro-expansion.

First apply patch to work-around 2 elsa bugs and to switch a couple of macros to functions(for outparamdel) https://bugzilla.mozilla.org/attachment.cgi?id=277809 Without this patch 2 files in Mozilla will fail to parse and outparamdel won't be able to special-case or even rewrite code in NS_FAILED and NS_SUCCEEDED macros.

cd mozilla/ export CC="gcc34 -Wp,-W0 -Wp,-K -save-temps" export CXX="g++34 -Wp,-W0 -Wp,-K -save-temps" make -f client.mk build

This will build mozilla in ../ff-build/ -Wp causes gcc to pass the following option to the preprocessor. -W0 silences MCPP's many warnings. MCPP was conceived as a standards-compliant C preprocessor that gets unhappy with numerous non-standard CPP features used in linux headers and Mozilla sources. -K is the magic new flag that annotates macro-expansions so elsa can make sense of the reshuffling of code due to preprocessing.

Running outparamdel

pork-barrel is a magic tool that can run outparamdel in parallel and merge overlapping patches produced from individual files.

  1. find ~/ff-build/ -name \*.ii > /tmp/list.txt
    This produces a list of all processed C++ files in Mozilla
  2. ./pork-barrel 4 ~/oink-stack/oink/outparamdel /tmp/list.txt -od-list ~/oink-stack/oink/outparamdel_tests/queryinterface.txt > /tmp/queryinterface.diff 2> /tmp/queryinterface.err
    first parameter(4) is the number of processes to execute in parallel
    second parameter(~/oink-stack/oink/outparamdel): tool to run
    third parameter(/tmp/list.txt): list of input files
    rest( -od-list ~/oink-stack/oink/outparamdel_tests/queryinterface.txt): tool-specific parameters to be passed to the tool before the filename. In this case the list of functions to rewrite is in the text file.