This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: OT: gcc warning: implicit declaration of function


Dan Kegel wrote:

Looks like /usr/local/lib/gcc-lib/arm-elf/3.3/include/stdlib.h
is nearly empty on your system.



/usr/local/lib/gcc-lib/arm-elf/3.3/include/stdlib.h: \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ #ifndef __stdlib_h #define __stdlib_h

#define __need_size_t
#include <stddef.h>

#if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || defined (__STRICT_ANSI__)
#ifndef abort
extern void abort (void);
#endif
extern int abs (int);
<snip>
#endif /* defined(__USE_FIXED_PROTOTYPES__) || ... */
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#endif /* __stdlib_h */
/////////////////////////////////////////////////////////////




Furthermore, doing a full compile (no -c) results in something that looks reasonable.


test.c \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ #include <stdlib.h> int main(int argc, char *argv[]) { int a = abs(argv[0]); return a; } /////////////////////////////////////////////////////////////


arm-elf-objdump -DS test.o \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ test.o: file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
#include <stdlib.h>

int main(int argc, char *argv[])
{
   0:	e1a0c00d 	mov	ip, sp
   4:	e92dd800 	stmdb	sp!, {fp, ip, lr, pc}
   8:	e24cb004 	sub	fp, ip, #4	; 0x4
   c:	e24dd00c 	sub	sp, sp, #12	; 0xc
  10:	e50b0010 	str	r0, [fp, -#16]
  14:	e50b1014 	str	r1, [fp, -#20]
	int a = abs(argv[0]);
  18:	e51b3014 	ldr	r3, [fp, -#20]
  1c:	e5933000 	ldr	r3, [r3]
  20:	e3530000 	cmp	r3, #0	; 0x0
  24:	b2633000 	rsblt	r3, r3, #0	; 0x0
  28:	e50b3018 	str	r3, [fp, -#24]

	return a;
  2c:	e51b3018 	ldr	r3, [fp, -#24]
}
  30:	e1a00003 	mov	r0, r3
  34:	e91ba800 	ldmdb	fp, {fp, sp, pc}
Disassembly of section .data:
/////////////////////////////////////////////////////////////

Sure, it's optimized out any function call, but I'd want that to happen! Why do I get the warning when it builds correctly anyway? Am I missing one of those defines that the stdlib.h needs, and why?

Thanks.


-- Bryce Schober Design Engineer Dynon Avionics, Inc. www.dynonavionics.com

---
[This E-mail scanned for viruses by digiposs.com]


------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]