[2/2] doc: install: document UBSAN_OPTIONS

Message ID f97c3215024ca9f2754b974215211c95050b39aa.1730409074.git.sam@gentoo.org
State New
Headers
Series [1/2] doc: install: document bootstrap-ubsan |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Test passed

Commit Message

Sam James Oct. 31, 2024, 9:11 p.m. UTC
  Explain that 'bootstrap-ubsan' won't abort on errors by default and how
to override that by setting UBSAN_OPTIONS.

gcc/ChangeLog:
	PR other/116948

	* doc/install.texi (Building a native compiler): Document UBSAN_OPTIONS.
---
 gcc/doc/install.texi | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Sam James Nov. 6, 2024, 10:19 a.m. UTC | #1
Sam James <sam@gentoo.org> writes:

> Explain that 'bootstrap-ubsan' won't abort on errors by default and how
> to override that by setting UBSAN_OPTIONS.
>
> gcc/ChangeLog:
> 	PR other/116948
>
> 	* doc/install.texi (Building a native compiler): Document UBSAN_OPTIONS.
> ---
>  gcc/doc/install.texi | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
> index 85896721a0ac..188ce4ba964a 100644
> --- a/gcc/doc/install.texi
> +++ b/gcc/doc/install.texi
> @@ -3153,7 +3153,9 @@ systems that are running Linux kernel version 5.4 or later.
>  
>  @item @samp{bootstrap-ubsan}
>  Compiles GCC itself using Undefined Behavior Sanitization in order to catch
> -undefined behavior within the GCC code.
> +undefined behavior within the GCC code.  Note that it does not abort on errors
> +by default.  @code{UBSAN_OPTIONS} can be set to change this, like
> +@samp{UBSAN_OPTIONS='abort_on_error=1:print_summary=1:print_stacktrace=1'}.

After discussion with Filip, he found that halt_on_error=1 is needed as
well, and abort_on_error tweaks the behaviour (exit vs abort) when that
is set, but it doesn't work by itself. I've added halt_on_error=1 on top
locally.

>  
>  @end table
  
Filip Kastl Nov. 6, 2024, 10:38 a.m. UTC | #2
On Wed 2024-11-06 10:19:12, Sam James wrote:
> Sam James <sam@gentoo.org> writes:
> 
> > Explain that 'bootstrap-ubsan' won't abort on errors by default and how
> > to override that by setting UBSAN_OPTIONS.
> >
> > gcc/ChangeLog:
> > 	PR other/116948
> >
> > 	* doc/install.texi (Building a native compiler): Document UBSAN_OPTIONS.
> > ---
> >  gcc/doc/install.texi | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
> > index 85896721a0ac..188ce4ba964a 100644
> > --- a/gcc/doc/install.texi
> > +++ b/gcc/doc/install.texi
> > @@ -3153,7 +3153,9 @@ systems that are running Linux kernel version 5.4 or later.
> >  
> >  @item @samp{bootstrap-ubsan}
> >  Compiles GCC itself using Undefined Behavior Sanitization in order to catch
> > -undefined behavior within the GCC code.
> > +undefined behavior within the GCC code.  Note that it does not abort on errors
> > +by default.  @code{UBSAN_OPTIONS} can be set to change this, like
> > +@samp{UBSAN_OPTIONS='abort_on_error=1:print_summary=1:print_stacktrace=1'}.
> 
> After discussion with Filip, he found that halt_on_error=1 is needed as
> well, and abort_on_error tweaks the behaviour (exit vs abort) when that
> is set, but it doesn't work by itself. I've added halt_on_error=1 on top
> locally.
> 
> >  
> >  @end table

With this change the patch looks good to me.

Cheers,
Filip
  
Jakub Jelinek Nov. 6, 2024, 10:58 a.m. UTC | #3
On Wed, Nov 06, 2024 at 11:38:21AM +0100, Filip Kastl wrote:
> On Wed 2024-11-06 10:19:12, Sam James wrote:
> > Sam James <sam@gentoo.org> writes:
> > 
> > > Explain that 'bootstrap-ubsan' won't abort on errors by default and how
> > > to override that by setting UBSAN_OPTIONS.
> > >
> > > gcc/ChangeLog:
> > > 	PR other/116948
> > >
> > > 	* doc/install.texi (Building a native compiler): Document UBSAN_OPTIONS.
> > > ---
> > >  gcc/doc/install.texi | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
> > > index 85896721a0ac..188ce4ba964a 100644
> > > --- a/gcc/doc/install.texi
> > > +++ b/gcc/doc/install.texi
> > > @@ -3153,7 +3153,9 @@ systems that are running Linux kernel version 5.4 or later.
> > >  
> > >  @item @samp{bootstrap-ubsan}
> > >  Compiles GCC itself using Undefined Behavior Sanitization in order to catch
> > > -undefined behavior within the GCC code.
> > > +undefined behavior within the GCC code.  Note that it does not abort on errors
> > > +by default.  @code{UBSAN_OPTIONS} can be set to change this, like
> > > +@samp{UBSAN_OPTIONS='abort_on_error=1:print_summary=1:print_stacktrace=1'}.
> > 
> > After discussion with Filip, he found that halt_on_error=1 is needed as
> > well, and abort_on_error tweaks the behaviour (exit vs abort) when that
> > is set, but it doesn't work by itself. I've added halt_on_error=1 on top
> > locally.
> > 
> > >  
> > >  @end table
> 
> With this change the patch looks good to me.

Ok for trunk with that change.

	Jakub
  

Patch

diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 85896721a0ac..188ce4ba964a 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -3153,7 +3153,9 @@  systems that are running Linux kernel version 5.4 or later.
 
 @item @samp{bootstrap-ubsan}
 Compiles GCC itself using Undefined Behavior Sanitization in order to catch
-undefined behavior within the GCC code.
+undefined behavior within the GCC code.  Note that it does not abort on errors
+by default.  @code{UBSAN_OPTIONS} can be set to change this, like
+@samp{UBSAN_OPTIONS='abort_on_error=1:print_summary=1:print_stacktrace=1'}.
 
 @end table