* Re: [Linux-ia64] new toolchain snapshots
2000-08-30 23:54 [Linux-ia64] new toolchain snapshots Jim Wilson
@ 2000-08-31 7:12 ` Keith Owens
2000-08-31 12:44 ` Dan Pop
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Keith Owens @ 2000-08-31 7:12 UTC (permalink / raw)
To: linux-ia64
On Wed, 30 Aug 2000 16:54:29 -0700,
Jim Wilson <wilson@cygnus.com> wrote:
>I am making available new toolchain snapshots, based on July FSF gcc sources.
>These snapshots are available from ftp.cygnus.com in pub/ia64-linux. The
>current snapshot is in the snap-000828 directory.
I'm getting a lot of warnings for format %p with the new toolchain on
kernel 2.4.0-test7, e.g.
pci-dma.c:100: warning: void format, char arg (arg 2)
static char *io_tlb_start, *io_tlb_end;
printk("Placing software IO TLB between 0x%p - 0x%p\n", io_tlb_start, io_tlb_end);
What is the correct way to handle these? Cast all pointers to (void *)
for printing or is there a compiler option I can use to make %p accept
any pointer, i.e. the old behaviour?
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Linux-ia64] new toolchain snapshots
2000-08-30 23:54 [Linux-ia64] new toolchain snapshots Jim Wilson
2000-08-31 7:12 ` Keith Owens
@ 2000-08-31 12:44 ` Dan Pop
2000-08-31 17:43 ` David Mosberger
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Dan Pop @ 2000-08-31 12:44 UTC (permalink / raw)
To: linux-ia64
On Thu, 31 Aug 2000, Keith Owens wrote:
> I'm getting a lot of warnings for format %p with the new toolchain on
> kernel 2.4.0-test7, e.g.
>
> pci-dma.c:100: warning: void format, char arg (arg 2)
>
> static char *io_tlb_start, *io_tlb_end;
> printk("Placing software IO TLB between 0x%p - 0x%p\n", io_tlb_start, io_tlb_end);
>
> What is the correct way to handle these? Cast all pointers to (void *)
> for printing or is there a compiler option I can use to make %p accept
> any pointer, i.e. the old behaviour?
The *correct* way to fix it is to cast every argument corresponding to
a %p to void *, because this is what the C standard requires for printf.
Dan
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Linux-ia64] new toolchain snapshots
2000-08-30 23:54 [Linux-ia64] new toolchain snapshots Jim Wilson
2000-08-31 7:12 ` Keith Owens
2000-08-31 12:44 ` Dan Pop
@ 2000-08-31 17:43 ` David Mosberger
2000-08-31 20:08 ` Jim Wilson
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: David Mosberger @ 2000-08-31 17:43 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 31 Aug 2000 14:44:59 +0200 (MET DST), Dan Pop <Dan.Pop@cern.ch> said:
Dan> On Thu, 31 Aug 2000, Keith Owens wrote:
>> I'm getting a lot of warnings for format %p with the new
>> toolchain on kernel 2.4.0-test7, e.g.
>>
>> pci-dma.c:100: warning: void format, char arg (arg 2)
>>
>> static char *io_tlb_start, *io_tlb_end; printk("Placing software
>> IO TLB between 0x%p - 0x%p\n", io_tlb_start, io_tlb_end);
>>
>> What is the correct way to handle these? Cast all pointers to
>> (void *) for printing or is there a compiler option I can use to
>> make %p accept any pointer, i.e. the old behaviour?
Dan> The *correct* way to fix it is to cast every argument
Dan> corresponding to a %p to void *, because this is what the C
Dan> standard requires for printf.
Geez, gotta love ANSI C... I'll fix the ia64 specific kernel files.
--david
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Linux-ia64] new toolchain snapshots
2000-08-30 23:54 [Linux-ia64] new toolchain snapshots Jim Wilson
` (2 preceding siblings ...)
2000-08-31 17:43 ` David Mosberger
@ 2000-08-31 20:08 ` Jim Wilson
2000-08-31 20:23 ` David Mosberger
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jim Wilson @ 2000-08-31 20:08 UTC (permalink / raw)
To: linux-ia64
I'm getting a lot of warnings for format %p with the new toolchain on
kernel 2.4.0-test7, e.g.
Before everyone goes and changes a lot of code, you should be aware that these
warnings have since changed several times in the FSF gcc sources. And will
likely change again in the future.
The current FSF gcc sources won't give a warning for void * or char * used
with %p, and will accept other pointer types if you aren't using -pedantic.
We can either live with the current set of warnings, or I can try to bring over
patches from more recent FSF gcc sources to make them go away.
Jim
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Linux-ia64] new toolchain snapshots
2000-08-30 23:54 [Linux-ia64] new toolchain snapshots Jim Wilson
` (3 preceding siblings ...)
2000-08-31 20:08 ` Jim Wilson
@ 2000-08-31 20:23 ` David Mosberger
2000-08-31 22:19 ` Jim Wilson
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: David Mosberger @ 2000-08-31 20:23 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 31 Aug 2000 13:08:07 -0700, Jim Wilson <wilson@cygnus.com> said:
Jim> I'm getting a lot of warnings for format %p with the new
Jim> toolchain on kernel 2.4.0-test7, e.g.
Jim> Before everyone goes and changes a lot of code, you should be
Jim> aware that these warnings have since changed several times in
Jim> the FSF gcc sources. And will likely change again in the
Jim> future.
Jim> The current FSF gcc sources won't give a warning for void * or
Jim> char * used with %p, and will accept other pointer types if you
Jim> aren't using -pedantic.
Jim> We can either live with the current set of warnings, or I can
Jim> try to bring over patches from more recent FSF gcc sources to
Jim> make them go away.
OK, sounds good.
I should say that this issue bothers me much less than those stupid
"format is not a string constant" messages. The reason I hate those
messages is because this is the only place gcc gives a warning without
there being a way to get rid of it. I don't think this warning should
be turned on for -Wall.
--david
PS: Yeah, I realize that I'm probably barking up the wrong tree.... ;-)
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Linux-ia64] new toolchain snapshots
2000-08-30 23:54 [Linux-ia64] new toolchain snapshots Jim Wilson
` (4 preceding siblings ...)
2000-08-31 20:23 ` David Mosberger
@ 2000-08-31 22:19 ` Jim Wilson
2000-08-31 22:29 ` David Mosberger
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jim Wilson @ 2000-08-31 22:19 UTC (permalink / raw)
To: linux-ia64
Jim> We can either live with the current set of warnings, or I can
Jim> try to bring over patches from more recent FSF gcc sources to
Jim> make them go away.
>OK, sounds good.
What sounds good: living with it, or patching it away?
>PS: Yeah, I realize that I'm probably barking up the wrong tree.... ;-)
You are welcome to send a complaint to gcc-bugs@gcc.gnu.org.
Jim
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Linux-ia64] new toolchain snapshots
2000-08-30 23:54 [Linux-ia64] new toolchain snapshots Jim Wilson
` (5 preceding siblings ...)
2000-08-31 22:19 ` Jim Wilson
@ 2000-08-31 22:29 ` David Mosberger
2000-09-01 4:49 ` Keith Owens
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: David Mosberger @ 2000-08-31 22:29 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 31 Aug 2000 15:19:10 -0700, Jim Wilson <wilson@cygnus.com> said:
Jim> We can either live with the current set of warnings, or I can
Jim> try to bring over patches from more recent FSF gcc sources to
Jim> make them go away.
>> OK, sounds good.
Jim> What sounds good: living with it, or patching it away?
Either way, actually. I don't care much which way it goes, though in
the short term the old behavior (no warning when a pointer to a type
other than void is passed) is better, as it avoids massive amounts of
warnings.
>> PS: Yeah, I realize that I'm probably barking up the wrong
>> tree.... ;-)
Jim> You are welcome to send a complaint to gcc-bugs@gcc.gnu.org.
Will do.
--david
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Linux-ia64] new toolchain snapshots
2000-08-30 23:54 [Linux-ia64] new toolchain snapshots Jim Wilson
` (6 preceding siblings ...)
2000-08-31 22:29 ` David Mosberger
@ 2000-09-01 4:49 ` Keith Owens
2000-09-02 3:01 ` Jim Wilson
2000-09-02 4:00 ` Keith Owens
9 siblings, 0 replies; 11+ messages in thread
From: Keith Owens @ 2000-09-01 4:49 UTC (permalink / raw)
To: linux-ia64
On Wed, 30 Aug 2000 16:54:29 -0700,
Jim Wilson <wilson@cygnus.com> wrote:
>I am making available new toolchain snapshots, based on July FSF gcc sources.
>These snapshots are available from ftp.cygnus.com in pub/ia64-linux. The
>current snapshot is in the snap-000828 directory.
Compiling the 2.4.0-test7 code for fs/nfs/dir.c with this snapshot
generates an unresolved reference to __multi3, for no reason that I can
see. The strange thing is that nm shows the unresolved reference but
objdump -r does not list it. BTW, I applied the glibc 2.1.3 patch.
This patch stops the toolchain snapshot generating the reference to
__multi3. Damned if I know why it works but it does.
Index: 0-test7.6/fs/nfs/dir.c
--- 0-test7.6/fs/nfs/dir.c Thu, 24 Aug 2000 03:29:10 +1000 kaos (linux-2.4/h/b/37_dir.c 1.1.1.4 644)
+++ 0-test7.6(w)/fs/nfs/dir.c Fri, 01 Sep 2000 15:43:21 +1100 kaos (linux-2.4/h/b/37_dir.c 1.1.1.4 644)
@@ -807,7 +807,7 @@ static int nfs_sillyrename(struct inode
static unsigned int sillycounter = 0;
const int i_inosize = sizeof(dir_i->i_ino)*2;
const int countersize = sizeof(sillycounter)*2;
- const int slen = strlen(".nfs") + i_inosize + countersize;
+ const int slen = 4 + i_inosize + countersize;
char silly[slen+1];
struct qstr qsilly;
struct dentry *sdentry;
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Linux-ia64] new toolchain snapshots
2000-08-30 23:54 [Linux-ia64] new toolchain snapshots Jim Wilson
` (7 preceding siblings ...)
2000-09-01 4:49 ` Keith Owens
@ 2000-09-02 3:01 ` Jim Wilson
2000-09-02 4:00 ` Keith Owens
9 siblings, 0 replies; 11+ messages in thread
From: Jim Wilson @ 2000-09-02 3:01 UTC (permalink / raw)
To: linux-ia64
Compiling the 2.4.0-test7 code for fs/nfs/dir.c with this snapshot
generates an unresolved reference to __multi3, for no reason that I can
see.
There is no reference to __multi3. Only a declaration for it. The .s file has
.globl __multi3
This causes it to be put in the symbol table where nm can see it, but does
not result in any relocation for it because we aren't using it. This should
be harmless.
const int slen = strlen(".nfs") + i_inosize + countersize;
char silly[slen+1];
As for how we got there, the code is using a dynamic array/variable length
array. If the size of the array is not a constant, then we must compute its
size at runtime so we can allocate it. The size of the array is not a
constant because of the strlen call. We can expand this as a built-in
function, but the result isn't a constant, it is a register (that holds a
constant). Anyways, as far as the compiler is concerned it isn't a constant.
Internally, gcc computes object sizes as both bits and bytes. This helps with
things like bitfields and bit-strings in Pascal like languages. Since the
maximum size of an object is 2^64 bytes, a size in bits must be computed as
a 128 bit value to avoid losing precision. We don't support 128 values
directly, so we have to call a libgcc library routine for the multiplication.
This routine is __multi3. After generating code, the optimizer quickly figures
out that the object size is a constant after all, and the call to __multi3
is optimized away. However, since we thought we needed the call when first
generating code, we emitted a declaration for it, because this is the default
for ELF targets. This is because some assemblers give an error if you use
a function or variable before declaring it. GNU as does not have this problem,
but the Intel as does.
This problem goes away if you replace the strlen call with a 4, because then
the object size is obviously a constant, and we don't need run-time code to
compute its size in bits.
If this really needs to be fixed for some reason, then we could override the
default definition of ASM_OUTPUT_EXTERNAL_LIBCALL. We could define it to
only emit the __multi3 declaration if ias is being used.
Jim
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Linux-ia64] new toolchain snapshots
2000-08-30 23:54 [Linux-ia64] new toolchain snapshots Jim Wilson
` (8 preceding siblings ...)
2000-09-02 3:01 ` Jim Wilson
@ 2000-09-02 4:00 ` Keith Owens
9 siblings, 0 replies; 11+ messages in thread
From: Keith Owens @ 2000-09-02 4:00 UTC (permalink / raw)
To: linux-ia64
On Fri, 01 Sep 2000 20:01:21 -0700,
Jim Wilson <wilson@cygnus.com> wrote:
> Compiling the 2.4.0-test7 code for fs/nfs/dir.c with this snapshot
> generates an unresolved reference to __multi3, for no reason that I can
> see.
>
>There is no reference to __multi3. Only a declaration for it. The .s file has
> .globl __multi3
>This causes it to be put in the symbol table where nm can see it, but does
>not result in any relocation for it because we aren't using it. This should
>be harmless.
It breaks modutils, depmod assumes that all unresolved externals in a
module are actually used. I will complain to the modutils maintainer,
hang on, that's me :(.
^ permalink raw reply [flat|nested] 11+ messages in thread