This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[GOLD][COMMITTED] Fix build breakage due to format warning.
- From: =?big5?b?RG91ZyBLd2FuICjD9q62vHcp?= <dougkwan at google dot com>
- To: binutils at sourceware dot org, Ian Lance Taylor <iant at google dot com>
- Date: Fri, 16 Oct 2009 11:37:15 -0700
- Subject: [GOLD][COMMITTED] Fix build breakage due to format warning.
Hi,
I've just commited this to fix a build breakage due to format
string warnings.
2009-10-16 Doug Kwan <dougkwan@google.com>
* output.cc (Output_segment::set_section_list_address): Cast
expressions to unsigned long long type to avoid format warnings.
----------------------------------------------------------
Index: gold/output.cc
===================================================================
RCS file: /cvs/src/src/gold/output.cc,v
retrieving revision 1.100
diff -u -p -r1.100 output.cc
--- gold/output.cc 16 Oct 2009 05:00:29 -0000 1.100
+++ gold/output.cc 16 Oct 2009 18:32:29 -0000
@@ -3503,15 +3503,20 @@ Output_segment::set_section_list_address
else
{
Output_section* os = (*p)->output_section();
+
+ // Cast to unsigned long long to avoid format warnings.
+ unsigned long long previous_dot =
+ static_cast<unsigned long long>(addr + (off - startoff));
+ unsigned long long dot =
+ static_cast<unsigned long long>((*p)->address());
+
if (os == NULL)
gold_error(_("dot moves backward in linker script "
- "from 0x%llx to 0x%llx"),
- addr + (off - startoff), (*p)->address());
+ "from 0x%llx to 0x%llx"), previous_dot, dot);
else
gold_error(_("address of section '%s' moves backward "
"from 0x%llx to 0x%llx"),
- os->name(), addr + (off - startoff),
- (*p)->address());
+ os->name(), previous_dot, dot);
}
}
(*p)->set_file_offset(off);
----------------------------------------------------------
make all-recursive
make[1]: Entering directory `/home/dougkwan/gold-cvs-2/obj/gold'
Making all in po
make[2]: Entering directory `/home/dougkwan/gold-cvs-2/obj/gold/po'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/dougkwan/gold-cvs-2/obj/gold/po'
Making all in testsuite
make[2]: Entering directory `/home/dougkwan/gold-cvs-2/obj/gold/testsuite'
make all-am
make[3]: Entering directory `/home/dougkwan/gold-cvs-2/obj/gold/testsuite'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/dougkwan/gold-cvs-2/obj/gold/testsuite'
make[2]: Leaving directory `/home/dougkwan/gold-cvs-2/obj/gold/testsuite'
make[2]: Entering directory `/home/dougkwan/gold-cvs-2/obj/gold'
g++ -DHAVE_CONFIG_H -I. -I../../src/gold -I../../src/gold
-I../../src/gold/../include -I../../src/gold/../elfcpp
-DLOCALEDIR="\"/usr/local/share/locale\""
-DBINDIR="\"/usr/local/bin\""
-DTOOLBINDIR="\"/usr/local/x86_64-unknown-linux-gnu/bin\"" -W -Wall
-Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-frandom-seed=output.o -g -O2 -MT output.o -MD -MP -MF
.deps/output.Tpo -c -o output.o ../../src/gold/output.cc
cc1plus: warnings being treated as errors
../../src/gold/output.cc: In member function ‘uint64_t
gold::Output_segment::set_section_list_addresses(const gold::Layout*,
bool, std::list<gold::Output_data*, std::allocator<gold::Output_data*>
>*, uint64_t, off_t*, unsigned int*, bool*, bool*)’:
../../src/gold/output.cc:3509: warning: format ‘%llx’ expects type
‘long long unsigned int’, but argument 2 has type ‘long unsigned int’
../../src/gold/output.cc:3509: warning: format ‘%llx’ expects type
‘long long unsigned int’, but argument 3 has type ‘uint64_t’
../../src/gold/output.cc:3514: warning: format ‘%llx’ expects type
‘long long unsigned int’, but argument 3 has type ‘long unsigned int’
../../src/gold/output.cc:3514: warning: format ‘%llx’ expects type
‘long long unsigned int’, but argument 4 has type ‘uint64_t’
make[2]: *** [output.o] Error 1
make[2]: Leaving directory `/home/dougkwan/gold-cvs-2/obj/gold'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dougkwan/gold-cvs-2/obj/gold'
make: *** [all] Error 2