From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 25F823857815 for ; Sun, 30 Aug 2020 14:28:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 25F823857815 Received: by mail-pl1-x62e.google.com with SMTP id y6so1820251plt.3 for ; Sun, 30 Aug 2020 07:28:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=1i/kpGD6XEeg6ckpR2+UyRJqv4KbjRiAj3fm1B46HH8=; b=mn8m0TF4+2SzH0UlzTgZpnE43Ty2cFF5fLwTMgBoJxKJUFyiv3Tgl/NCK3jssTNLOt sxILQ8PY9JaeF+rQyXC9SrxM+s2PQxtxlekaTKxz9iYlCHNHpj7ZB3xnHRLvakB+ibd0 x/SkB+yOkWvi12xZ7ZYGEWJuv7Ayuwcma69/7QfD+PgtgD791zIKPDlEoj/7/AuiYpEn bJ4FcQYi5QsfBSolyty2sW8owz7xw144PRYVettGdChEU+MZadcI+Tm5G8Isjt/ExVbw gMlhfUimX/QQasesw4NF6DYoRQ/Z9FfzgH7BHMKcS/J8fW4U9Db5uZPdnlHTHApvSz+t JAFQ== X-Gm-Message-State: AOAM530wlcTKnOFc6a8eQybPfEUZv/0sZ8xfjHeAzWNVtWKaePSjsVUp FW2I2u2oJPOeSGcsdPUTH9rpCmDKmsE= X-Google-Smtp-Source: ABdhPJxVAXs3h9zfB1futcvqzKjCm1ppr1zh26fMtHx2Wzqj9RihI6f5+jmlFAbNDSkTAiK2rVUG1w== X-Received: by 2002:a17:90a:9415:: with SMTP id r21mr6583618pjo.204.1598797732906; Sun, 30 Aug 2020 07:28:52 -0700 (PDT) Received: from gnu-cfl-2.localdomain (c-69-181-90-243.hsd1.ca.comcast.net. [69.181.90.243]) by smtp.gmail.com with ESMTPSA id n68sm4958289pfn.145.2020.08.30.07.28.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Aug 2020 07:28:52 -0700 (PDT) Received: from gnu-cfl-2.localdomain (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id 45E5E1A03F4 for ; Sun, 30 Aug 2020 07:28:51 -0700 (PDT) From: "H.J. Lu" To: binutils@sourceware.org Subject: [PATCH] ld: Add $NOSANTIZE_CFLAGS to more linker tests Date: Sun, 30 Aug 2020 07:28:51 -0700 Message-Id: <20200830142851.672196-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Aug 2020 14:29:04 -0000 * testsuite/ld-elf/dwarf.exp: Append $NOSANTIZE_CFLAGS to CFLAGS. * testsuite/ld-elf/shared.exp: Likewise. * testsuite/ld-elfvsb/elfvsb.exp: Likewise. * testsuite/ld-shared/shared.exp: Likewise. * testsuite/ld-size/size.exp: Likewise. --- ld/ChangeLog | 8 ++++++++ ld/testsuite/ld-elf/dwarf.exp | 4 ++++ ld/testsuite/ld-elf/shared.exp | 4 ++++ ld/testsuite/ld-elfvsb/elfvsb.exp | 13 +++++++------ ld/testsuite/ld-shared/shared.exp | 6 ++++++ ld/testsuite/ld-size/size.exp | 7 ++++--- 6 files changed, 33 insertions(+), 9 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 77e39a5614..0138e88db0 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2020-08-30 H.J. Lu + + * testsuite/ld-elf/dwarf.exp: Append $NOSANTIZE_CFLAGS to CFLAGS. + * testsuite/ld-elf/shared.exp: Likewise. + * testsuite/ld-elfvsb/elfvsb.exp: Likewise. + * testsuite/ld-shared/shared.exp: Likewise. + * testsuite/ld-size/size.exp: Likewise. + 2020-08-28 Jozef Lawrynowicz * emultempl/msp430.em (input_section_exists): New. diff --git a/ld/testsuite/ld-elf/dwarf.exp b/ld/testsuite/ld-elf/dwarf.exp index 4d2c35d540..93fd21d8f3 100644 --- a/ld/testsuite/ld-elf/dwarf.exp +++ b/ld/testsuite/ld-elf/dwarf.exp @@ -68,8 +68,12 @@ set run_tests { "-g -feliminate-dwarf2-dups"} } +# Disable all sanitizers. +set old_CFLAGS "$CFLAGS" +append CFLAGS " $NOSANTIZE_CFLAGS" run_cc_link_tests $build_tests run_ld_link_exec_tests $run_tests +set CFLAGS "$old_CFLAGS" proc strip_test {} { global ld diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 66da7203df..fb04cc3ac8 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -1102,7 +1102,11 @@ set dlopen_run_tests [list \ if [check_libdl_available] { # XFAIL on NetBSD ELF systems as they do not currently support the .*_array # sections. + # Disable all sanitizers. + set old_CFLAGS "$CFLAGS" + append CFLAGS " $NOSANTIZE_CFLAGS" run_ld_link_exec_tests $dlopen_run_tests "*-*-netbsdelf*" + set CFLAGS "$old_CFLAGS" } # Check --no-add-needed and --no-copy-dt-needed-entries diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp index 3a242d3527..673e0a0155 100644 --- a/ld/testsuite/ld-elfvsb/elfvsb.exp +++ b/ld/testsuite/ld-elfvsb/elfvsb.exp @@ -197,6 +197,7 @@ proc visibility_run {visibility} { global PLT_CFLAGS global NOPIE_CFLAGS global COMPRESS_LDFLAG + global NOSANTIZE_CFLAGS if [ string match $visibility "hidden" ] { set VSBCFLAG "-DHIDDEN_TEST" @@ -235,7 +236,7 @@ proc visibility_run {visibility} { } else { # Compile the main program. Make sure that PLT is used since PLT # is expected. - if ![ld_compile "$CC -g $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] { + if ![ld_compile "$CC -g $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG $NOSANTIZE_CFLAGS" $srcdir/$subdir/main.c $tmpdir/mainnp.o] { unresolved "visibility ($visibility) (non PIC)" unresolved "visibility ($visibility)" } else { @@ -245,8 +246,8 @@ proc visibility_run {visibility} { # will need to do more relocation work. However, note that not # using -fpic will cause some of the tests to return different # results. Make sure that PLT is used since PLT is expected. - if { ![ld_compile "$CC -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o] - || ![ld_compile "$CC -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } { + if { ![ld_compile "$CC -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG $NOSANTIZE_CFLAGS" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o] + || ![ld_compile "$CC -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG $NOSANTIZE_CFLAGS" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } { unresolved "visibility ($visibility) (non PIC)" } else { # SunOS non PIC shared libraries don't permit some cases of @@ -334,8 +335,8 @@ proc visibility_run {visibility} { # Now compile the code using -fpic. - if { ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG -DSHARED $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o] - || ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG -DSHARED $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } { + if { ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG $NOSANTIZE_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o] + || ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG $NOSANTIZE_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } { unresolved "visibility ($visibility)" } else { if { [ string match $visibility "protected" ] @@ -352,7 +353,7 @@ proc visibility_run {visibility} { # Don't bother. } else { # Now do the same tests again, but this time compile main.c PIC. - if ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG -DSHARED $picflag" $srcdir/$subdir/main.c $tmpdir/mainp.o] { + if ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG $NOSANTIZE_CFLAGS -DSHARED $picflag" $srcdir/$subdir/main.c $tmpdir/mainp.o] { unresolved "visibility ($visibility) (PIC main, non PIC so)" unresolved "visibility ($visibility) (PIC main)" } else { diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp index fa64730775..eb346e9c6a 100644 --- a/ld/testsuite/ld-shared/shared.exp +++ b/ld/testsuite/ld-shared/shared.exp @@ -65,6 +65,10 @@ set tmpdir tmpdir set SHCFLAG "" set shared_needs_pic "no" +# Disable all sanitizers. +set old_CFLAGS "$CFLAGS" +append CFLAGS " $NOSANTIZE_CFLAGS" + if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } { # AIX shared libraries do not seem to support useful features, @@ -343,6 +347,8 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/m } } +set CFLAGS "$old_CFLAGS" + if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } { # Remove the temporary directory. catch "exec rm -rf $tmpdir" exec_status diff --git a/ld/testsuite/ld-size/size.exp b/ld/testsuite/ld-size/size.exp index 8a9459993a..40d8cda90c 100644 --- a/ld/testsuite/ld-size/size.exp +++ b/ld/testsuite/ld-size/size.exp @@ -134,8 +134,8 @@ run_cc_link_tests [list \ ] \ [list \ "Build libsize-9.so" \ - "-shared" \ - "-fPIC" \ + "-shared $NOSANTIZE_CFLAGS" \ + "-fPIC $NOSANTIZE_CFLAGS" \ {size-9b.c} \ {{readelf -rW size-9.rd}} \ "libsize-9.so" \ @@ -284,11 +284,12 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-9" \ - "-Wl,--no-as-needed tmpdir/libsize-9.so" \ + "-Wl,--no-as-needed tmpdir/libsize-9.so $NOSANTIZE_CFLAGS" \ "" \ {size-9a.c} \ "size-9" \ "size-9.out" \ + "$NOSANTIZE_CFLAGS" \ ] \ [list \ "Run size-10" \ -- 2.26.2