google / sanitizers

AddressSanitizer, ThreadSanitizer, MemorySanitizer
Other
11.32k stars 1.02k forks source link

Building libsanitizer with old glibc (2.5) fails with error #1019

Open marxin opened 5 years ago

marxin commented 5 years ago

It's GCC build:

../../../../git/gcc/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:699:10: error: ‘CPU_COUNT’ was not declared in this scope
  699 |   return CPU_COUNT(&CPUs);
      |          ^~~~~~~~~

It's quite clear that it's caused by r318802: https://reviews.llvm.org/D40121

The conditional block is guarded with:

#elif SANITIZER_ANDROID && !defined(CPU_COUNT) && !defined(__aarch64__)

but then the CPU_COUNT is used:

  return CPU_COUNT(&CPUs);
krytarowski commented 5 years ago

2006-09-29 glibc 2.5 (https://sourceware.org/glibc/wiki/Glibc%20Timeline)... is it still worth to support?

krytarowski commented 5 years ago

A potential fallback implementation:

https://github.com/aglevine/TheoUnc/blob/85e8569084e2092bf663b7b82e062a4667d4b388/HLTrigger/Timer/src/CPUAffinity.cc#L12-L21

marxin commented 5 years ago

Can you please send a patch with the fallback implementation?

krytarowski commented 5 years ago

Me? No, I don't use Linux.

marxin commented 5 years ago

I'm planning to fix that upstream then..