* gcc (4.6) compile warnings/errors
@ 2011-03-29 23:56 Simon Horman
2011-03-29 23:56 ` [PATCH 1/3] build: Pass --no-undefined as a linker option Simon Horman
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Simon Horman @ 2011-03-29 23:56 UTC (permalink / raw)
To: kexec; +Cc: Eric W. Biederman
Hi,
this short series resolves a error and some warnings
when compiling for x86_64 using gcc-4.6.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] build: Pass --no-undefined as a linker option
2011-03-29 23:56 gcc (4.6) compile warnings/errors Simon Horman
@ 2011-03-29 23:56 ` Simon Horman
2011-03-29 23:56 ` [PATCH 2/3] Remove assigned but otherwise unused variables Simon Horman
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2011-03-29 23:56 UTC (permalink / raw)
To: kexec; +Cc: Simon Horman, Eric W. Biederman
gcc-4.6 does not accept --no-undefined as a compiler option
Reported-by: Civil <civil.over@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
purgatory/Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/purgatory/Makefile b/purgatory/Makefile
index ea0c19a..ee1679c 100644
--- a/purgatory/Makefile
+++ b/purgatory/Makefile
@@ -56,8 +56,8 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
-I$(srcdir)/include \
-I$(shell $(CC) -print-file-name=include)
$(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\
- --no-undefined -nostartfiles -nostdlib -nodefaultlibs \
- -e purgatory_start -r
+ -Wl,--no-undefined -nostartfiles -nostdlib \
+ -nodefaultlibs -e purgatory_start -r
$(PURGATORY): $(PURGATORY_OBJS)
$(MKDIR) -p $(@D)
--
1.7.2.3
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] Remove assigned but otherwise unused variables
2011-03-29 23:56 gcc (4.6) compile warnings/errors Simon Horman
2011-03-29 23:56 ` [PATCH 1/3] build: Pass --no-undefined as a linker option Simon Horman
@ 2011-03-29 23:56 ` Simon Horman
2011-03-29 23:56 ` [PATCH 3/3] Don't compare signed and unsigned types Simon Horman
2011-03-30 2:37 ` gcc (4.6) compile warnings/errors Eric W. Biederman
3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2011-03-29 23:56 UTC (permalink / raw)
To: kexec; +Cc: Simon Horman, Eric W. Biederman
Signed-off-by: Simon Horman <horms@verge.net.au>
---
kexec/arch/x86_64/kexec-elf-x86_64.c | 3 ---
kexec/kexec.c | 4 +---
vmcore-dmesg/vmcore-dmesg.c | 3 +--
3 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/kexec/arch/x86_64/kexec-elf-x86_64.c b/kexec/arch/x86_64/kexec-elf-x86_64.c
index 09402d9..fe4b76b 100644
--- a/kexec/arch/x86_64/kexec-elf-x86_64.c
+++ b/kexec/arch/x86_64/kexec-elf-x86_64.c
@@ -90,7 +90,6 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
const char *append = NULL;
char *command_line = NULL, *modified_cmdline;
int command_line_len;
- int modified_cmdline_len;
const char *ramdisk;
unsigned long entry, max_addr;
int arg_style;
@@ -120,7 +119,6 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
*/
arg_style = ARG_STYLE_ELF;
modified_cmdline = 0;
- modified_cmdline_len = 0;
ramdisk = 0;
while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
switch(opt) {
@@ -174,7 +172,6 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
COMMAND_LINE_SIZE);
modified_cmdline[COMMAND_LINE_SIZE - 1] = '\0';
}
- modified_cmdline_len = strlen(modified_cmdline);
}
/* Load the ELF executable */
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 10ad41d..2515c07 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -815,9 +815,7 @@ static int my_shutdown(void)
*/
static int my_exec(void)
{
- int result;
-
- result = kexec_reboot();
+ kexec_reboot();
/* I have failed if I make it here */
fprintf(stderr, "kexec failed: %s\n",
strerror(errno));
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
index 365e293..4c1475c 100644
--- a/vmcore-dmesg/vmcore-dmesg.c
+++ b/vmcore-dmesg/vmcore-dmesg.c
@@ -79,7 +79,7 @@ static void read_elf32(int fd)
{
Elf32_Ehdr ehdr32;
Elf32_Phdr *phdr32;
- size_t phdrs32_size, phdrs_size;
+ size_t phdrs32_size;
ssize_t ret, i;
ret = pread(fd, &ehdr32, sizeof(ehdr32), 0);
@@ -114,7 +114,6 @@ static void read_elf32(int fd)
exit(12);
}
phdrs32_size = ehdr.e_phnum * sizeof(Elf32_Phdr);
- phdrs_size = ehdr.e_phnum * sizeof(Elf64_Phdr);
phdr32 = calloc(ehdr.e_phnum, sizeof(Elf32_Phdr));
if (!phdr32) {
fprintf(stderr, "Calloc of %u phdrs32 failed: %s\n",
--
1.7.2.3
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] Don't compare signed and unsigned types
2011-03-29 23:56 gcc (4.6) compile warnings/errors Simon Horman
2011-03-29 23:56 ` [PATCH 1/3] build: Pass --no-undefined as a linker option Simon Horman
2011-03-29 23:56 ` [PATCH 2/3] Remove assigned but otherwise unused variables Simon Horman
@ 2011-03-29 23:56 ` Simon Horman
2011-03-30 2:37 ` gcc (4.6) compile warnings/errors Eric W. Biederman
3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2011-03-29 23:56 UTC (permalink / raw)
To: kexec; +Cc: Simon Horman, Eric W. Biederman
Signed-off-by: Simon Horman <horms@verge.net.au>
---
vmcore-dmesg/vmcore-dmesg.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
index 4c1475c..8518150 100644
--- a/vmcore-dmesg/vmcore-dmesg.c
+++ b/vmcore-dmesg/vmcore-dmesg.c
@@ -127,7 +127,7 @@ static void read_elf32(int fd)
exit(15);
}
ret = pread(fd, phdr32, phdrs32_size, ehdr.e_phoff);
- if (ret != phdrs32_size) {
+ if (ret < 0 || (size_t)ret != phdrs32_size) {
fprintf(stderr, "Read of program header @ 0x%llu for %zu bytes failed: %s\n",
(unsigned long long)ehdr.e_phoff, phdrs32_size, strerror(errno));
exit(16);
@@ -154,7 +154,7 @@ static void read_elf64(int fd)
ssize_t ret, i;
ret = pread(fd, &ehdr64, sizeof(ehdr64), 0);
- if (ret != sizeof(ehdr)) {
+ if (ret < 0 || (size_t)ret != sizeof(ehdr)) {
fprintf(stderr, "Read of Elf header from %s failed: %s\n",
fname, strerror(errno));
exit(10);
@@ -198,7 +198,7 @@ static void read_elf64(int fd)
exit(15);
}
ret = pread(fd, phdr64, phdrs_size, ehdr.e_phoff);
- if (ret != phdrs_size) {
+ if (ret < 0 || (size_t)ret != phdrs_size) {
fprintf(stderr, "Read of program header @ %llu for %zu bytes failed: %s\n",
(unsigned long long)(ehdr.e_phoff), phdrs_size, strerror(errno));
exit(16);
@@ -239,8 +239,7 @@ static void scan_vmcoreinfo(char *start, size_t size)
};
for (pos = start; pos <= last; pos = eol + 1) {
- size_t len;
- int i;
+ size_t len, i;
/* Find the end of the current line */
for (eol = pos; (eol <= last) && (*eol != '\n') ; eol++)
;
@@ -276,7 +275,7 @@ static void scan_notes(int fd, loff_t start, loff_t lsize)
size_t size;
ssize_t ret;
- if (lsize > LONG_MAX) {
+ if (lsize > SSIZE_MAX) {
fprintf(stderr, "Unable to handle note section of %llu bytes\n",
(unsigned long long)lsize);
exit(20);
@@ -289,7 +288,7 @@ static void scan_notes(int fd, loff_t start, loff_t lsize)
}
last = buf + size - 1;
ret = pread(fd, buf, size, start);
- if (ret != size) {
+ if (ret != (ssize_t)size) {
fprintf(stderr, "Cannot read note section @ 0x%llx of %zu bytes: %s\n",
(unsigned long long)start, size, strerror(errno));
exit(22);
--
1.7.2.3
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: gcc (4.6) compile warnings/errors
2011-03-29 23:56 gcc (4.6) compile warnings/errors Simon Horman
` (2 preceding siblings ...)
2011-03-29 23:56 ` [PATCH 3/3] Don't compare signed and unsigned types Simon Horman
@ 2011-03-30 2:37 ` Eric W. Biederman
2011-03-30 3:07 ` Simon Horman
3 siblings, 1 reply; 6+ messages in thread
From: Eric W. Biederman @ 2011-03-30 2:37 UTC (permalink / raw)
To: Simon Horman; +Cc: kexec
Simon Horman <horms@verge.net.au> writes:
> Hi,
>
> this short series resolves a error and some warnings
> when compiling for x86_64 using gcc-4.6.
This series seems reasonable to me.
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Eric
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gcc (4.6) compile warnings/errors
2011-03-30 2:37 ` gcc (4.6) compile warnings/errors Eric W. Biederman
@ 2011-03-30 3:07 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2011-03-30 3:07 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: kexec
On Tue, Mar 29, 2011 at 07:37:38PM -0700, Eric W. Biederman wrote:
> Simon Horman <horms@verge.net.au> writes:
>
> > Hi,
> >
> > this short series resolves a error and some warnings
> > when compiling for x86_64 using gcc-4.6.
>
> This series seems reasonable to me.
>
> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Thanks Eric, I have pushed the series with your Ack.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-03-30 3:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29 23:56 gcc (4.6) compile warnings/errors Simon Horman
2011-03-29 23:56 ` [PATCH 1/3] build: Pass --no-undefined as a linker option Simon Horman
2011-03-29 23:56 ` [PATCH 2/3] Remove assigned but otherwise unused variables Simon Horman
2011-03-29 23:56 ` [PATCH 3/3] Don't compare signed and unsigned types Simon Horman
2011-03-30 2:37 ` gcc (4.6) compile warnings/errors Eric W. Biederman
2011-03-30 3:07 ` Simon Horman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.