[lld] 4ae1c2c - [ELF] Delete unneeded hack for discarding empty name local symbol

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 2 12:39:38 PDT 2021


I guess this bot https://lab.llvm.org/buildbot/#/builders/77/builds/10821
is broken by that patch
main() is gone from the trace

******************** TEST 'AddressSanitizer-arm-android ::
TestCases/use-after-scope-types.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1';
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/sanitizer_common/android_commands/android_compile.py
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm_build64/bin/clang
--driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer
-fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only
--target=armv7-linux-androideabi24
--sysroot=/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot
--gcc-toolchain=/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64
-B/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64
-Wthread-safety -Wthread-safety-reference -Wthread-safety-beta
-stdlib=libc++ -fuse-ld=lld -shared-libasan -O0
-fsanitize-address-use-after-scope
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
-o
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
: 'RUN: at line 2'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
0 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
: 'RUN: at line 3'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
1 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
: 'RUN: at line 4'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
2 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
: 'RUN: at line 5'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
3 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
: 'RUN: at line 6'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
4 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
: 'RUN: at line 7'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
5 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
: 'RUN: at line 8'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
6 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
: 'RUN: at line 9'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
7 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
: 'RUN: at line 10'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
8 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
: 'RUN: at line 11'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
9 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
: 'RUN: at line 12'; not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
10 2>&1 | FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
--
Exit Code: 1
Command Output (stderr):
--
+ : 'RUN: at line 1'
+
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/sanitizer_common/android_commands/android_compile.py
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm_build64/bin/clang
--driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer
-fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only
--target=armv7-linux-androideabi24
--sysroot=/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot
--gcc-toolchain=/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64
-B/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64
-Wthread-safety -Wthread-safety-reference -Wthread-safety-beta
-stdlib=libc++ -fuse-ld=lld -shared-libasan -O0
-fsanitize-address-use-after-scope
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
-o
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
+ : 'RUN: at line 2'
+ not
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp
0
+ FileCheck
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp:44:12:
error: CHECK: expected string not found in input
// CHECK: #{{[0-9]+}} 0x{{.*}} in {{(void )?test.*\((void)?\)
.*}}use-after-scope-types.cpp
^
<stdin>:2:55: note: scanning from here
==2843==ERROR: AddressSanitizer: stack-use-after-scope on address
0xff8d5de0 at pc 0x02f53dec bp 0xff8d5d98 sp 0xff8d5d94
^
<stdin>:4:107: note: possible intended match here
#0 0x2f53de8 in Ptr<bool>::Access()
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp:21:22
^
Input file: <stdin>
Check file:
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: =================================================================
2: ==2843==ERROR: AddressSanitizer: stack-use-after-scope on address
0xff8d5de0 at pc 0x02f53dec bp 0xff8d5d98 sp 0xff8d5d94
check:44'0
X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error:
no match found
3: WRITE of size 1 at 0xff8d5de0 thread T0
check:44'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4: #0 0x2f53de8 in Ptr<bool>::Access()
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp:21:22

check:44'0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:44'1 ? possible intended match
5: #1 0x2f52a4c
(/data/local/tmp/Output/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp+0x3a4c)

check:44'0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6: #2 0x2f52860
(/data/local/tmp/Output/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_arm/test/asan/ARMAndroidConfig/TestCases/Output/use-after-scope-types.cpp.tmp+0x3860)

check:44'0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7: #3 0xf0eff3f0 in __libc_init
(/apex/com.android.runtime/lib/bionic/libc.so+0x323f0)
check:44'0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8:
check:44'0 ~
9: Address 0xff8d5de0 is located in stack of thread T0 at offset 32 in
frame
check:44'0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.
.
.
>>>>>>
--
********************

On Mon, 25 Oct 2021 at 11:55, Fangrui Song via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

>
> Author: Fangrui Song
> Date: 2021-10-25T11:55:31-07:00
> New Revision: 4ae1c2c6f1b3a0085a0fb0909005e62da156e051
>
> URL:
> https://github.com/llvm/llvm-project/commit/4ae1c2c6f1b3a0085a0fb0909005e62da156e051
> DIFF:
> https://github.com/llvm/llvm-project/commit/4ae1c2c6f1b3a0085a0fb0909005e62da156e051.diff
>
> LOG: [ELF] Delete unneeded hack for discarding empty name local symbol
>
> This actually improves GNU ld compatibility.
> Correct assemblers don't create such symbols.
>
> Also simplify the code.
>
> Added:
>
>
> Modified:
>     lld/ELF/Writer.cpp
>
> Removed:
>     lld/test/ELF/Inputs/discard-merge-unnamed.o
>     lld/test/ELF/discard-merge-unnamed.s
>
>
>
> ################################################################################
> diff  --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
> index 3e2e9a528353e..c9b613d82547e 100644
> --- a/lld/ELF/Writer.cpp
> +++ b/lld/ELF/Writer.cpp
> @@ -727,16 +727,11 @@ static bool shouldKeepInSymtab(const Defined &sym) {
>    // * --discard-locals is used.
>    // * The symbol is in a SHF_MERGE section, which is normally the reason
> for
>    //   the assembler keeping the .L symbol.
> -  StringRef name = sym.getName();
> -  bool isLocal = name.startswith(".L") || name.empty();
> -  if (!isLocal)
> -    return true;
> -
> -  if (config->discard == DiscardPolicy::Locals)
> +  if (sym.getName().startswith(".L") &&
> +      (config->discard == DiscardPolicy::Locals ||
> +       (sym.section && (sym.section->flags & SHF_MERGE))))
>      return false;
> -
> -  SectionBase *sec = sym.section;
> -  return !sec || !(sec->flags & SHF_MERGE);
> +  return true;
>  }
>
>  static bool includeInSymtab(const Symbol &b) {
>
> diff  --git a/lld/test/ELF/Inputs/discard-merge-unnamed.o
> b/lld/test/ELF/Inputs/discard-merge-unnamed.o
> deleted file mode 100644
> index 040addf04f4ec..0000000000000
> Binary files a/lld/test/ELF/Inputs/discard-merge-unnamed.o and /dev/null
> diff er
>
> diff  --git a/lld/test/ELF/discard-merge-unnamed.s
> b/lld/test/ELF/discard-merge-unnamed.s
> deleted file mode 100644
> index 2bd38737081b5..0000000000000
> --- a/lld/test/ELF/discard-merge-unnamed.s
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -// RUN: ld.lld %p/Inputs/discard-merge-unnamed.o -o %t2 -shared
> -// RUN: llvm-readobj --symbols %t2 | FileCheck %s
> -
> -// Test that the unnamed symbol is SHF_MERGE is omitted.
> -
> -// CHECK:      Symbols [
> -// CHECK-NEXT:   Symbol {
> -// CHECK-NEXT:     Name:  (0)
> -// CHECK-NEXT:     Value: 0x0
> -// CHECK-NEXT:     Size: 0
> -// CHECK-NEXT:     Binding: Local
> -// CHECK-NEXT:     Type: None
> -// CHECK-NEXT:     Other: 0
> -// CHECK-NEXT:     Section: Undefined
> -// CHECK-NEXT:   }
> -// CHECK-NEXT:   Symbol {
> -// CHECK-NEXT:     Name: _DYNAMIC
> -// CHECK-NEXT:     Value:
> -// CHECK-NEXT:     Size: 0
> -// CHECK-NEXT:     Binding: Local
> -// CHECK-NEXT:     Type: None
> -// CHECK-NEXT:     Other [ (0x2)
> -// CHECK-NEXT:       STV_HIDDEN
> -// CHECK-NEXT:     ]
> -// CHECK-NEXT:     Section: .dynamic
> -// CHECK-NEXT:   }
> -// CHECK-NEXT: ]
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211102/6cc64368/attachment.html>


More information about the llvm-commits mailing list