[PATCH] D56516: [SanitizerCoverage] Don't create comdat for weak functions.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 9 15:45:43 PST 2019


morehouse added a comment.

Minimal repro:

  $ cat weak.c 
  #include <stdio.h>
  
  __attribute__((weak)) void f() {fprintf(stderr, "Weak!\n");}
  
  $ cat strong.c 
  #include <stdio.h>
  
  void f() {fprintf(stderr, "Strong!\n");}
  
  $ cat fuzz.c 
  #include <stdint.h>
  #include <stddef.h>
  
  void f();
  
  int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
    f();
    return 1;
  }
  
  $ cat main.c 
  void f();
  
  int main() {
    f();
    return 0;
  }
  
  $ clang main.c weak.c strong.c && ./a.out
  Strong!
  
  $ clang -fsanitize=fuzzer fuzz.c weak.c strong.c && ./a.out 
  ...
  Weak!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56516/new/

https://reviews.llvm.org/D56516





More information about the llvm-commits mailing list