diff mbox series

[v2,2/3] elf: Skip tst-auditlogmod-* if the linker doesn't support --depaudit [BZ #28151]

Message ID 20210805162601.1200851-3-maskray@google.com
State Committed
Commit 9926f6e2eeb374cf729d4bb3f092dd4b36a8f861
Headers show
Series Allow LLD 13.0.0 and improve compatibility with gold and clang | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Fāng-ruì Sòng Aug. 5, 2021, 4:26 p.m. UTC
gold and ld.lld do not support --audit or --depaudit.
---
 configure    | 34 ++++++++++++++++++++++++++++++++++
 configure.ac |  4 ++++
 elf/Makefile |  4 +++-
 3 files changed, 41 insertions(+), 1 deletion(-)

Comments

Fāng-ruì Sòng Aug. 16, 2021, 4:59 a.m. UTC | #1
Ping..

On Thu, Aug 5, 2021 at 9:26 AM Fangrui Song <maskray@google.com> wrote:
>
> gold and ld.lld do not support --audit or --depaudit.
> ---
>  configure    | 34 ++++++++++++++++++++++++++++++++++
>  configure.ac |  4 ++++
>  elf/Makefile |  4 +++-
>  3 files changed, 41 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 9619c10991..9b966196d4 100755
> --- a/configure
> +++ b/configure
> @@ -5969,6 +5969,40 @@ $as_echo "$libc_linker_feature" >&6; }
>  config_vars="$config_vars
>  have-z-start-stop-gc = $libc_cv_z_start_stop_gc"
>
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --depaudit" >&5
> +$as_echo_n "checking for linker that supports --depaudit... " >&6; }
> +libc_linker_feature=no
> +if test x"$gnu_ld" = x"yes"; then
> +  libc_linker_check=`$LD -v --help 2>/dev/null | grep "\--depaudit"`
> +  if test -n "$libc_linker_check"; then
> +    cat > conftest.c <<EOF
> +int _start (void) { return 42; }
> +EOF
> +    if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
> +                               -Wl,--depaudit,x -nostdlib -nostartfiles
> +                               -fPIC -shared -o conftest.so conftest.c
> +                               1>&5'
> +  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> +  (eval $ac_try) 2>&5
> +  ac_status=$?
> +  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> +  test $ac_status = 0; }; }
> +    then
> +      libc_linker_feature=yes
> +    fi
> +    rm -f conftest*
> +  fi
> +fi
> +if test $libc_linker_feature = yes; then
> +  libc_cv_depaudit=yes
> +else
> +  libc_cv_depaudit=no
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
> +$as_echo "$libc_linker_feature" >&6; }
> +config_vars="$config_vars
> +have-depaudit = $libc_cv_depaudit"
> +
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-dynamic-linker" >&5
>  $as_echo_n "checking for linker that supports --no-dynamic-linker... " >&6; }
>  libc_linker_feature=no
> diff --git a/configure.ac b/configure.ac
> index 34ecbba540..17a4c9a1ab 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1337,6 +1337,10 @@ LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
>                     [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
>  LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
>
> +LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
> +                   [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
> +LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
> +
>  LIBC_LINKER_FEATURE([--no-dynamic-linker],
>                     [-Wl,--no-dynamic-linker],
>                     [libc_cv_no_dynamic_linker=yes],
> diff --git a/elf/Makefile b/elf/Makefile
> index d05f410592..b62278ee86 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -219,7 +219,6 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
>          tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \
>          tst-dlopenfail-2 \
>          tst-filterobj tst-filterobj-dlopen tst-auxobj tst-auxobj-dlopen \
> -        tst-audit14 tst-audit15 tst-audit16 tst-audit17 \
>          tst-single_threaded tst-single_threaded-pthread \
>          tst-tls-ie tst-tls-ie-dlmopen argv0test \
>          tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \
> @@ -238,6 +237,9 @@ selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
>  ifneq ($(selinux-enabled),1)
>  tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
>  endif
> +ifeq ($(have-depaudit),yes)
> +tests += tst-audit14 tst-audit15 tst-audit16
> +endif
>  endif
>  tests += $(tests-execstack-$(have-z-execstack))
>  ifeq ($(run-built-tests),yes)
> --
> 2.32.0.605.g8dce9f2422-goog
>
Fāng-ruì Sòng Aug. 24, 2021, 3:56 a.m. UTC | #2
I'll push this specific commit if there are no objections.

On Sun, Aug 15, 2021 at 9:59 PM Fāng-ruì Sòng <maskray@google.com> wrote:
>
> Ping..
>
> On Thu, Aug 5, 2021 at 9:26 AM Fangrui Song <maskray@google.com> wrote:
> >
> > gold and ld.lld do not support --audit or --depaudit.
> > ---
> >  configure    | 34 ++++++++++++++++++++++++++++++++++
> >  configure.ac |  4 ++++
> >  elf/Makefile |  4 +++-
> >  3 files changed, 41 insertions(+), 1 deletion(-)
> >
> > diff --git a/configure b/configure
> > index 9619c10991..9b966196d4 100755
> > --- a/configure
> > +++ b/configure
> > @@ -5969,6 +5969,40 @@ $as_echo "$libc_linker_feature" >&6; }
> >  config_vars="$config_vars
> >  have-z-start-stop-gc = $libc_cv_z_start_stop_gc"
> >
> > +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --depaudit" >&5
> > +$as_echo_n "checking for linker that supports --depaudit... " >&6; }
> > +libc_linker_feature=no
> > +if test x"$gnu_ld" = x"yes"; then
> > +  libc_linker_check=`$LD -v --help 2>/dev/null | grep "\--depaudit"`
> > +  if test -n "$libc_linker_check"; then
> > +    cat > conftest.c <<EOF
> > +int _start (void) { return 42; }
> > +EOF
> > +    if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
> > +                               -Wl,--depaudit,x -nostdlib -nostartfiles
> > +                               -fPIC -shared -o conftest.so conftest.c
> > +                               1>&5'
> > +  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> > +  (eval $ac_try) 2>&5
> > +  ac_status=$?
> > +  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> > +  test $ac_status = 0; }; }
> > +    then
> > +      libc_linker_feature=yes
> > +    fi
> > +    rm -f conftest*
> > +  fi
> > +fi
> > +if test $libc_linker_feature = yes; then
> > +  libc_cv_depaudit=yes
> > +else
> > +  libc_cv_depaudit=no
> > +fi
> > +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
> > +$as_echo "$libc_linker_feature" >&6; }
> > +config_vars="$config_vars
> > +have-depaudit = $libc_cv_depaudit"
> > +
> >  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-dynamic-linker" >&5
> >  $as_echo_n "checking for linker that supports --no-dynamic-linker... " >&6; }
> >  libc_linker_feature=no
> > diff --git a/configure.ac b/configure.ac
> > index 34ecbba540..17a4c9a1ab 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1337,6 +1337,10 @@ LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
> >                     [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
> >  LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
> >
> > +LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
> > +                   [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
> > +LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
> > +
> >  LIBC_LINKER_FEATURE([--no-dynamic-linker],
> >                     [-Wl,--no-dynamic-linker],
> >                     [libc_cv_no_dynamic_linker=yes],
> > diff --git a/elf/Makefile b/elf/Makefile
> > index d05f410592..b62278ee86 100644
> > --- a/elf/Makefile
> > +++ b/elf/Makefile
> > @@ -219,7 +219,6 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
> >          tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \
> >          tst-dlopenfail-2 \
> >          tst-filterobj tst-filterobj-dlopen tst-auxobj tst-auxobj-dlopen \
> > -        tst-audit14 tst-audit15 tst-audit16 tst-audit17 \
> >          tst-single_threaded tst-single_threaded-pthread \
> >          tst-tls-ie tst-tls-ie-dlmopen argv0test \
> >          tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \
> > @@ -238,6 +237,9 @@ selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
> >  ifneq ($(selinux-enabled),1)
> >  tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
> >  endif
> > +ifeq ($(have-depaudit),yes)
> > +tests += tst-audit14 tst-audit15 tst-audit16
> > +endif
> >  endif
> >  tests += $(tests-execstack-$(have-z-execstack))
> >  ifeq ($(run-built-tests),yes)
> > --
> > 2.32.0.605.g8dce9f2422-goog
> >
>
>
> --
> 宋方睿
Adhemerval Zanella Aug. 24, 2021, 12:04 p.m. UTC | #3
On 05/08/2021 13:26, Fangrui Song via Libc-alpha wrote:
> gold and ld.lld do not support --audit or --depaudit.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  configure    | 34 ++++++++++++++++++++++++++++++++++
>  configure.ac |  4 ++++
>  elf/Makefile |  4 +++-
>  3 files changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 9619c10991..9b966196d4 100755
> --- a/configure
> +++ b/configure
> @@ -5969,6 +5969,40 @@ $as_echo "$libc_linker_feature" >&6; }
>  config_vars="$config_vars
>  have-z-start-stop-gc = $libc_cv_z_start_stop_gc"
>  
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --depaudit" >&5
> +$as_echo_n "checking for linker that supports --depaudit... " >&6; }
> +libc_linker_feature=no
> +if test x"$gnu_ld" = x"yes"; then
> +  libc_linker_check=`$LD -v --help 2>/dev/null | grep "\--depaudit"`
> +  if test -n "$libc_linker_check"; then
> +    cat > conftest.c <<EOF
> +int _start (void) { return 42; }
> +EOF
> +    if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
> +				-Wl,--depaudit,x -nostdlib -nostartfiles
> +				-fPIC -shared -o conftest.so conftest.c
> +				1>&5'
> +  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> +  (eval $ac_try) 2>&5
> +  ac_status=$?
> +  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> +  test $ac_status = 0; }; }
> +    then
> +      libc_linker_feature=yes
> +    fi
> +    rm -f conftest*
> +  fi
> +fi
> +if test $libc_linker_feature = yes; then
> +  libc_cv_depaudit=yes
> +else
> +  libc_cv_depaudit=no
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
> +$as_echo "$libc_linker_feature" >&6; }
> +config_vars="$config_vars
> +have-depaudit = $libc_cv_depaudit"
> +
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-dynamic-linker" >&5
>  $as_echo_n "checking for linker that supports --no-dynamic-linker... " >&6; }
>  libc_linker_feature=no
> diff --git a/configure.ac b/configure.ac
> index 34ecbba540..17a4c9a1ab 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1337,6 +1337,10 @@ LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
>  		    [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
>  LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
>  
> +LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
> +		    [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
> +LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
> +
>  LIBC_LINKER_FEATURE([--no-dynamic-linker],
>  		    [-Wl,--no-dynamic-linker],
>  		    [libc_cv_no_dynamic_linker=yes],

Ok.

> diff --git a/elf/Makefile b/elf/Makefile
> index d05f410592..b62278ee86 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -219,7 +219,6 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
>  	 tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \
>  	 tst-dlopenfail-2 \
>  	 tst-filterobj tst-filterobj-dlopen tst-auxobj tst-auxobj-dlopen \
> -	 tst-audit14 tst-audit15 tst-audit16 tst-audit17 \
>  	 tst-single_threaded tst-single_threaded-pthread \
>  	 tst-tls-ie tst-tls-ie-dlmopen argv0test \
>  	 tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \
> @@ -238,6 +237,9 @@ selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
>  ifneq ($(selinux-enabled),1)
>  tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
>  endif
> +ifeq ($(have-depaudit),yes)
> +tests += tst-audit14 tst-audit15 tst-audit16
> +endif
>  endif
>  tests += $(tests-execstack-$(have-z-execstack))
>  ifeq ($(run-built-tests),yes)
> 

Ok.
diff mbox series

Patch

diff --git a/configure b/configure
index 9619c10991..9b966196d4 100755
--- a/configure
+++ b/configure
@@ -5969,6 +5969,40 @@  $as_echo "$libc_linker_feature" >&6; }
 config_vars="$config_vars
 have-z-start-stop-gc = $libc_cv_z_start_stop_gc"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --depaudit" >&5
+$as_echo_n "checking for linker that supports --depaudit... " >&6; }
+libc_linker_feature=no
+if test x"$gnu_ld" = x"yes"; then
+  libc_linker_check=`$LD -v --help 2>/dev/null | grep "\--depaudit"`
+  if test -n "$libc_linker_check"; then
+    cat > conftest.c <<EOF
+int _start (void) { return 42; }
+EOF
+    if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
+				-Wl,--depaudit,x -nostdlib -nostartfiles
+				-fPIC -shared -o conftest.so conftest.c
+				1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+    then
+      libc_linker_feature=yes
+    fi
+    rm -f conftest*
+  fi
+fi
+if test $libc_linker_feature = yes; then
+  libc_cv_depaudit=yes
+else
+  libc_cv_depaudit=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
+$as_echo "$libc_linker_feature" >&6; }
+config_vars="$config_vars
+have-depaudit = $libc_cv_depaudit"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-dynamic-linker" >&5
 $as_echo_n "checking for linker that supports --no-dynamic-linker... " >&6; }
 libc_linker_feature=no
diff --git a/configure.ac b/configure.ac
index 34ecbba540..17a4c9a1ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1337,6 +1337,10 @@  LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
 		    [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
 LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
 
+LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
+		    [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
+LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
+
 LIBC_LINKER_FEATURE([--no-dynamic-linker],
 		    [-Wl,--no-dynamic-linker],
 		    [libc_cv_no_dynamic_linker=yes],
diff --git a/elf/Makefile b/elf/Makefile
index d05f410592..b62278ee86 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -219,7 +219,6 @@  tests += restest1 preloadtest loadfail multiload origtest resolvfail \
 	 tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \
 	 tst-dlopenfail-2 \
 	 tst-filterobj tst-filterobj-dlopen tst-auxobj tst-auxobj-dlopen \
-	 tst-audit14 tst-audit15 tst-audit16 tst-audit17 \
 	 tst-single_threaded tst-single_threaded-pthread \
 	 tst-tls-ie tst-tls-ie-dlmopen argv0test \
 	 tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \
@@ -238,6 +237,9 @@  selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
 ifneq ($(selinux-enabled),1)
 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
 endif
+ifeq ($(have-depaudit),yes)
+tests += tst-audit14 tst-audit15 tst-audit16
+endif
 endif
 tests += $(tests-execstack-$(have-z-execstack))
 ifeq ($(run-built-tests),yes)