Merge "Downgrade W+E load segments to a warning unless targeting O."
diff --git a/benchmarks/math_benchmark.cpp b/benchmarks/math_benchmark.cpp
index 36ac301..a411c9c 100644
--- a/benchmarks/math_benchmark.cpp
+++ b/benchmarks/math_benchmark.cpp
@@ -25,7 +25,7 @@
 #define BENCHMARK_COMMON_VALS(name) BENCHMARK(name)->Arg(0)->Arg(1)->Arg(2)->Arg(3)
 
 static void SetLabel(benchmark::State& state) {
-  state.SetLabel(names[state.range_x()]);
+  state.SetLabel(names[state.range(0)]);
 }
 
 // Avoid optimization.
@@ -61,7 +61,7 @@
 
 static void BM_math_isfinite_macro(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += isfinite(v);
   }
@@ -76,7 +76,7 @@
 #endif
 static void BM_math_isfinite(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += test_isfinite(v);
   }
@@ -86,7 +86,7 @@
 
 static void BM_math_isinf_macro(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += isinf(v);
   }
@@ -96,7 +96,7 @@
 
 static void BM_math_isinf(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += (isinf)(v);
   }
@@ -106,7 +106,7 @@
 
 static void BM_math_isnan_macro(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += isnan(v);
   }
@@ -116,7 +116,7 @@
 
 static void BM_math_isnan(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += (isnan)(v);
   }
@@ -126,7 +126,7 @@
 
 static void BM_math_isnormal_macro(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += isnormal(v);
   }
@@ -137,7 +137,7 @@
 #if defined(__BIONIC__)
 static void BM_math_isnormal(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += (__isnormal)(v);
   }
@@ -180,7 +180,7 @@
 
 static void BM_math_fpclassify(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += fpclassify(v);
   }
@@ -190,7 +190,7 @@
 
 static void BM_math_signbit_macro(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += signbit(v);
   }
@@ -200,7 +200,7 @@
 
 static void BM_math_signbit(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += (__signbit)(v);
   }
@@ -210,7 +210,7 @@
 
 static void BM_math_fabs_macro(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += fabs(v);
   }
@@ -220,7 +220,7 @@
 
 static void BM_math_fabs(benchmark::State& state) {
   d = 0.0;
-  v = values[state.range_x()];
+  v = values[state.range(0)];
   while (state.KeepRunning()) {
     d += (fabs)(v);
   }
diff --git a/benchmarks/property_benchmark.cpp b/benchmarks/property_benchmark.cpp
index 4e82117..ef5f225 100644
--- a/benchmarks/property_benchmark.cpp
+++ b/benchmarks/property_benchmark.cpp
@@ -142,7 +142,7 @@
 };
 
 static void BM_property_get(benchmark::State& state) {
-  const size_t nprops = state.range_x();
+  const size_t nprops = state.range(0);
 
   LocalPropertyTestState pa(nprops);
   if (!pa.valid) return;
@@ -155,7 +155,7 @@
 BENCHMARK(BM_property_get)->TEST_NUM_PROPS;
 
 static void BM_property_find(benchmark::State& state) {
-  const size_t nprops = state.range_x();
+  const size_t nprops = state.range(0);
 
   LocalPropertyTestState pa(nprops);
   if (!pa.valid) return;
@@ -167,7 +167,7 @@
 BENCHMARK(BM_property_find)->TEST_NUM_PROPS;
 
 static void BM_property_read(benchmark::State& state) {
-  const size_t nprops = state.range_x();
+  const size_t nprops = state.range(0);
 
   LocalPropertyTestState pa(nprops);
   if (!pa.valid) return;
@@ -190,7 +190,7 @@
 BENCHMARK(BM_property_read)->TEST_NUM_PROPS;
 
 static void BM_property_serial(benchmark::State& state) {
-  const size_t nprops = state.range_x();
+  const size_t nprops = state.range(0);
 
   LocalPropertyTestState pa(nprops);
   if (!pa.valid) return;
diff --git a/benchmarks/stdio_benchmark.cpp b/benchmarks/stdio_benchmark.cpp
index a556d17..f496779 100644
--- a/benchmarks/stdio_benchmark.cpp
+++ b/benchmarks/stdio_benchmark.cpp
@@ -28,7 +28,7 @@
 
 template <typename Fn>
 void ReadWriteTest(benchmark::State& state, Fn f, bool buffered) {
-  size_t chunk_size = state.range_x();
+  size_t chunk_size = state.range(0);
 
   FILE* fp = fopen("/dev/zero", "rw");
   __fsetlocking(fp, FSETLOCKING_BYCALLER);
diff --git a/benchmarks/string_benchmark.cpp b/benchmarks/string_benchmark.cpp
index 0a38512..41306db 100644
--- a/benchmarks/string_benchmark.cpp
+++ b/benchmarks/string_benchmark.cpp
@@ -27,7 +27,7 @@
 // TODO: test unaligned operation too? (currently everything will be 8-byte aligned by malloc.)
 
 static void BM_string_memcmp(benchmark::State& state) {
-  const size_t nbytes = state.range_x();
+  const size_t nbytes = state.range(0);
   char* src = new char[nbytes]; char* dst = new char[nbytes];
   memset(src, 'x', nbytes);
   memset(dst, 'x', nbytes);
@@ -44,7 +44,7 @@
 BENCHMARK(BM_string_memcmp)->AT_COMMON_SIZES;
 
 static void BM_string_memcpy(benchmark::State& state) {
-  const size_t nbytes = state.range_x();
+  const size_t nbytes = state.range(0);
   char* src = new char[nbytes]; char* dst = new char[nbytes];
   memset(src, 'x', nbytes);
 
@@ -59,7 +59,7 @@
 BENCHMARK(BM_string_memcpy)->AT_COMMON_SIZES;
 
 static void BM_string_memmove(benchmark::State& state) {
-  const size_t nbytes = state.range_x();
+  const size_t nbytes = state.range(0);
   char* buf = new char[nbytes + 64];
   memset(buf, 'x', nbytes + 64);
 
@@ -73,7 +73,7 @@
 BENCHMARK(BM_string_memmove)->AT_COMMON_SIZES;
 
 static void BM_string_memset(benchmark::State& state) {
-  const size_t nbytes = state.range_x();
+  const size_t nbytes = state.range(0);
   char* dst = new char[nbytes];
 
   while (state.KeepRunning()) {
@@ -86,7 +86,7 @@
 BENCHMARK(BM_string_memset)->AT_COMMON_SIZES;
 
 static void BM_string_strlen(benchmark::State& state) {
-  const size_t nbytes = state.range_x();
+  const size_t nbytes = state.range(0);
   char* s = new char[nbytes];
   memset(s, 'x', nbytes);
   s[nbytes - 1] = 0;
diff --git a/libc/bionic/bionic_arc4random.cpp b/libc/bionic/bionic_arc4random.cpp
index d20cb68..429ff7f 100644
--- a/libc/bionic/bionic_arc4random.cpp
+++ b/libc/bionic/bionic_arc4random.cpp
@@ -38,7 +38,7 @@
 #include "private/libc_logging.h"
 
 void __libc_safe_arc4random_buf(void* buf, size_t n, KernelArgumentBlock& args) {
-  static bool have_getrandom = syscall(SYS_getrandom, nullptr, 0, 0) == -1 && errno != ENOSYS;
+  static bool have_getrandom = syscall(SYS_getrandom, nullptr, 0, 0) != -1 || errno != ENOSYS;
   static bool have_urandom = access("/dev/urandom", R_OK) == 0;
   static size_t at_random_bytes_consumed = 0;
 
diff --git a/libc/malloc_debug/backtrace.cpp b/libc/malloc_debug/backtrace.cpp
index 18ce8b8..75a255c 100644
--- a/libc/malloc_debug/backtrace.cpp
+++ b/libc/malloc_debug/backtrace.cpp
@@ -142,6 +142,8 @@
     if (dladdr(reinterpret_cast<void*>(frames[frame_num]), &info) != 0) {
       offset = reinterpret_cast<uintptr_t>(info.dli_saddr);
       symbol = info.dli_sname;
+    } else {
+      info.dli_fname = nullptr;
     }
 
     uintptr_t rel_pc = offset;