diff mbox

[ubsan] Add -static-libubsan

Message ID 20130730142358.GI17022@redhat.com
State New
Headers show

Commit Message

Marek Polacek July 30, 2013, 2:23 p.m. UTC
This adds missing -static-libubsan option.  It's already handled in
the gcc.c via various macros.

Tested x86_64-pc-linux-gnu, applying to ubsan branch.


	Marek
diff mbox

Patch

diff --git a/gcc/ChangeLog.ubsan b/gcc/ChangeLog.ubsan
index 3d15c19..47f81b4 100644
--- a/gcc/ChangeLog.ubsan
+++ b/gcc/ChangeLog.ubsan
@@ -1,3 +1,8 @@ 
+2013-07-29  Marek Polacek  <polacek@redhat.com>
+
+	* common.opt (static-libubsan): New option.
+	* doc/invoke.texi: Document -static-libubsan.
+
 2013-07-24  Marek Polacek  <polacek@redhat.com>
 
 	* ubsan.c (struct ubsan_typedesc): Improve comment.
diff --git a/gcc/common.opt b/gcc/common.opt
index 123d593..fe6bc9c 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2580,6 +2580,9 @@  Driver
 static-libtsan
 Driver
 
+static-libubsan
+Driver
+
 symbolic
 Driver
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 3596c6c..5dd9a62 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -452,7 +452,7 @@  Objective-C and Objective-C++ Dialects}.
 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
 -nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
 -s  -static -static-libgcc -static-libstdc++ @gol
--static-libasan -static-libtsan @gol
+-static-libasan -static-libtsan -static-libubsan @gol
 -shared -shared-libgcc  -symbolic @gol
 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
 -u @var{symbol}}
@@ -10102,6 +10102,15 @@  option is not used, then this links against the shared version of
 driver to link @file{libtsan} statically, without necessarily linking
 other libraries statically.
 
+@item -static-libubsan
+When the @option{-fsanitize=undefined} option is used to link a program,
+the GCC driver automatically links against @option{libubsan}.  If
+@file{libubsan} is available as a shared library, and the @option{-static}
+option is not used, then this links against the shared version of
+@file{libubsan}.  The @option{-static-libubsan} option directs the GCC
+driver to link @file{libubsan} statically, without necessarily linking
+other libraries statically.
+
 @item -static-libstdc++
 When the @command{g++} program is used to link a C++ program, it
 normally automatically links against @option{libstdc++}.  If