xref: /netbsd-src/external/gpl3/gcc.old/dist/libsanitizer/HOWTO_MERGE (revision c0a68be459da21030695f60d10265c2fc49758f8)
11debfc3dSmrgIn general, merging process should not be very difficult, but we need to
21debfc3dSmrgtrack various ABI changes and GCC-specific patches carefully.  Here is a
31debfc3dSmrggeneral list of actions required to perform the merge:
41debfc3dSmrg
51debfc3dSmrg* Checkout recent GCC tree.
6*c0a68be4Smrg* Run merge.sh script from libsanitizer directory.  The script accepts one
7*c0a68be4Smrg  argument that is control version system (svn or git).
81debfc3dSmrg* Modify Makefile.am files into asan/tsan/lsan/ubsan/sanitizer_common/interception
91debfc3dSmrg  directories if needed.  In particular, you may need to add new source files
101debfc3dSmrg  and remove old ones in source files list, add new flags to {C, CXX}FLAGS if
111debfc3dSmrg  needed and update DEFS with new defined variables.  You can find these changes
121debfc3dSmrg  in corresponding CMakeLists.txt and config-ix.cmake files from compiler-rt source
131debfc3dSmrg  directory.
141debfc3dSmrg* Apply all needed GCC-specific patches to libsanitizer (note that some of
151debfc3dSmrg  them might be already included to upstream).  The list of these patches is stored
161debfc3dSmrg  into LOCAL_PATCHES file.
171debfc3dSmrg* Apply all necessary compiler changes.  Be especially careful here, you must
181debfc3dSmrg  not break ABI between compiler and library.  You can reveal these changes by
191debfc3dSmrg  inspecting the history of AddressSanitizer.cpp and ThreadSanitizer.cpp files
201debfc3dSmrg  from LLVM source tree.
211debfc3dSmrg* Update ASan testsuite with corresponding tests from lib/asan/tests directory.
221debfc3dSmrg  Not all tests can be migrated easily, so you don't need them all to be adapted.
231debfc3dSmrg* Modify configure.ac file if needed (e.g. if you need to add link against new
24*c0a68be4Smrg  library for sanitizer libs).
251debfc3dSmrg* Add new target platforms in configure.tgt script if needed.
261debfc3dSmrg* Bump SONAME for sanitizer libraries in asan/tsan/ubsan libtool-version files
271debfc3dSmrg  if ABI has changed.
281debfc3dSmrg* Regenerate configure script and all Makefiles by autoreconf.  You should use
291debfc3dSmrg  exactly the same autoconf and automake versions as for other GCC directories (current
301debfc3dSmrg  versions are written in Makefile.in and configure files).
311debfc3dSmrg* Run regression testing on at least three platforms (e.g. x86-linux-gnu, x86_64-linux-gnu,
321debfc3dSmrg  aarch64-linux-gnu, arm-linux-gnueabi).
331debfc3dSmrg* Run {A, UB}San bootstrap on at least three platforms.
34*c0a68be4Smrg* Compare ABI of corresponding libclang_rt.asan and newly build libasan libraries.
35*c0a68be4Smrg  Similarly you can compare latest GCC release with the newly built libraries
36*c0a68be4Smrg  (libasan.so.*, libubsan.so.*, libtsan.so*).
371debfc3dSmrg  You can use a pretty good libabigail tool (https://sourceware.org/libabigail/index.html)
381debfc3dSmrg  to perform such a comparision.  Note, that the list of exported symbols may differ,
391debfc3dSmrg  e.g. because libasan currently does not include UBSan runtime.
401debfc3dSmrg* Split your changes into logical parts (e.g. raw merge, compiler changes, GCC-specific changes
411debfc3dSmrg  in libasan, configure/Makefile changes). The review process has O(N^2) complexity, so you
421debfc3dSmrg  would simplify and probably speed up the review process by doing this.
431debfc3dSmrg* Send your patches for review to GCC Patches Mailing List (gcc-patches@gcc.gnu.org).
441debfc3dSmrg* Update LOCAL_PATCHES file when you've committed the whole patch set with new revisions numbers.
45