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] |
Building arm-linux glibc-2.3.3 on an i386-redhat-linux(gcc-3.3.3) (FC2) system using a custom built gcc-3.4.0 arm-linux cross compiler terminates in: gmon/mcount.c undefined reference to `mcount_internal' collect2: ld returned 1 exit status After some adjustments, the error became a warning: mcount.c:60: warning: 'mcount_internal' defined but not used To avoid the warning if (0==1) mcount_internal(1,2); was added to sysdeps/arm/machine-gmon.h #define MCOUNT definition. With -O1, it was optimized out and did not appear in the .s file. Some attached source code (mod.c, mod.h, Makefile, main.c) simulates this situation. When compiling with ARM defined (make ARCH=ARM): -O2 reproduces the undefined reference error. -O1 reproduces the warning. -O1 AND if (0==1) gotohello(1,2); compiles with no warning. When compiling it with X86 defined (make ARCH=X86): -O[012] reproduces the warning. Should the fact that the native gcc does not reproduce the undefined reference error be a cause for concern? Instead of if (0==1) gotohello(1,2) to avoid the warning, is there a gcc extended asm construct that will alert the compiler of a function reference? The following all fail: asm("blne mcount_internal;") produces blne mcount_internal, without compiler noting a function reference. asm("blne %0" : : "i" (mcount_internal)); produces blne #mcount_internal, which is not what is desired. thanks, Byron Young spamiccling@yahoo.com BEGIN main.c int main(int argc, char * argv[], char * envp[]){ return 0; } END main.c BEGIN mod.c #include "mod.h" _GOTOHELLO_DECL(from, to) { return; } HELLO #ifdef X86 int func1(int i) { register int _k asm("ebx")=0xF0F0F0F0; asm ("inc %0" : : "r" (_k)); // asm ("jle %0" : : "i" (gotohello)); ERROR in .s->.o // asm ("jle %0" : : "s" (gotohello)); ERROR in .s->.o asm ("inc %0" : : "r" (_k)); return 1; } #endif #ifdef ARM int func1(int i) { register int _k asm("r3")=1234; asm("add %0,%1,#1" : "=g" (_k): "g" (_k)); // asm ("blne %0" : : "i" (gotohello)); ERROR in .s->.o return _k; } #endif END mod.c BEGIN mod.h void _hello(void); #define weak_alias(name, aliasname) \ extern __typeof(name) aliasname __attribute ((weak, alias (#name))); weak_alias (_hello, hello) static void gotohello(int from, int to); #define _GOTOHELLO_DECL(from, to) \ static void gotohello(int from, int to) #ifdef ARM #define HELLO \ void _hello (void) \ { \ __asm__("stmdb sp!, {r0, r1, r2, r3};" \ "movs fp, fp;" \ "moveq r1, #0;" \ "ldrne r1, [fp, $-4];" \ "ldrne r0, [fp, $-12];" \ "movnes r0, r0;" \ "ldrne r0, [r0, $-4];" \ "movs r0, r0;" \ "blne gotohello;" \ "ldmia sp!, {r0, r1, r2, r3}"); \ if (1==2) gotohello(1,2); \ } #endif #ifdef X86 #define HELLO \ void _hello (void) \ { \ __asm__("jle gotohello;" \ "nop;"); \ if (1==2) gotohello(1,2); \ } #endif END mod.h BEGIN Makefile all:main ifndef ARCH ARCH=ARM endif ifeq ($(ARCH),ARM) else ifeq ($(ARCH),X86) else ARCH=ARM endif endif ifeq ($(ARCH),ARM) PATH:=/home/bkyoung/arm/bin:/home/bkyoung/arm/arm-linux/bin:$(PATH) CC=arm-linux-gcc else ifeq ($(ARCH),X86) CC=gcc endif endif CFLAGS=-O1 -D$(ARCH) -g -Wall -Wstrict-prototypes -Wwrite-strings -fno-omit-frame-pointer SOURCES=main.c mod.c OBJS=$(SOURCES:.c=.o) HEADERS=mod.h main: $(SOURCES:.c=.o) $(CC) $(CFLAGS) $^ -o $@ %.i : %.c $(HEADERS) Makefile $(CC) $(CFLAGS) -E $< -o $@ %.s: %.i $(CC) $(CFLAGS) -S $< -o $@ %.o: %.s $(CC) $(CFLAGS) -c $< -o $@ %.o : %.c clean: $(RM) *~ $(RM) *.o $(RM) main $(RM) *.i $(RM) *.s SECONDARY:$(SOURCES:.c=.i) $(SOURCES:.c=.s) $(SOURCES:.c=.o) edit: emacs $(SOURCES:.c=.i) $(SOURCES:.c=.s) $(SOURCES) $(HEADERS) Makefile END Makefile __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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] |