From adb604a3879cdd7789204206d50ae2782d2538d9 Mon Sep 17 00:00:00 2001 From: Han Shen Date: Fri, 20 Nov 2015 14:02:29 -0800 Subject: Fix darwin build failures (because of compilation warnings). "%ld" is the printf specifier for "long int", which is 64-bit on 64-bit machines, and 32-bit on 32-bit hosts. While uint64_t is always 64 bits, so replace it with macro "PRIu64". Tested: ./build.py --host "linux" --toolchain aarch64-linux-android ./build.py --host "linux" --toolchain arm-linux-androideabi ./build.py --host "linux" --toolchain mipsel-linux-android ./build.py --host "windows" --toolchain arm-linux-androideabi Change-Id: I9f0b322ed14e6feb7a110bfebcff963cf94d7703 --- binutils-2.25/gold/gold.cc | 11 ++++++++--- binutils-2.25/gold/layout.cc | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/binutils-2.25/gold/gold.cc b/binutils-2.25/gold/gold.cc index eccbc589..b278b3c3 100644 --- a/binutils-2.25/gold/gold.cc +++ b/binutils-2.25/gold/gold.cc @@ -25,6 +25,9 @@ #include #include #include +// __STDC_FORMAT_MACROS is needed to turn on macros in inttypes.h. +#define __STDC_FORMAT_MACROS +#include #include #include #include "libiberty.h" @@ -597,9 +600,11 @@ queue_middle_tasks(const General_options& options, // perfectly and warn. So, this is fine. if (segment_size >= target->max_pie_data_segment_size()) { - gold_info(_("The data segment size (%ld > %ld) is likely unsafe and" - " PIE has been disabled for this link. See go/unsafe-pie."), - segment_size, target->max_pie_data_segment_size()); + gold_info( + _("The data segment size (%" PRIu64 " > %" PRIu64 ") is likely unsafe and" + " PIE has been disabled for this link. See go/unsafe-pie."), + segment_size, + target->max_pie_data_segment_size()); const_cast(¶meters->options())->set_pie_value(false); } } diff --git a/binutils-2.25/gold/layout.cc b/binutils-2.25/gold/layout.cc index 8b3a619a..18063a04 100644 --- a/binutils-2.25/gold/layout.cc +++ b/binutils-2.25/gold/layout.cc @@ -25,6 +25,9 @@ #include #include #include +// __STDC_FORMAT_MACROS is needed to turn on macros in inttypes.h. +#define __STDC_FORMAT_MACROS +#include #include #include #include @@ -2815,9 +2818,11 @@ Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab, data_seg_size = rw_memsz; if (data_seg_size >= target->max_pie_data_segment_size()) - gold_warning(_("Unsafe PIE data segment size (%ld > %ld). See " - "go/unsafe-pie."), - data_seg_size, target->max_pie_data_segment_size()); + gold_warning( + _("Unsafe PIE data segment size (%" PRIu64 " > %" PRIu64 "). See " + "go/unsafe-pie."), + data_seg_size, + target->max_pie_data_segment_size()); } // If there is a load segment that contains the file and program headers, -- cgit v1.2.3