2008-10-08 09:16:41     bfin-linux-uclibc-??? build asm error???

Document created by Aaronwu Employee on Aug 8, 2013
Version 1Show Document
  • View in full screen mode

2008-10-08 09:16:41     bfin-linux-uclibc-??? build asm error???

浩 何 (CHINA)

Message: 63266   

 

hi:

 

everyone,

 

I have a question when i build .S and .c

 

my  hello.S is as follow :

 

.extern _c;

.align  4;

.global  _add_x;

_add_x:

r0 = r0 + r1;

P0.L = _c;

    P0.H = _c; rts;

_add_x.end:

 

my hello.c :

 

#include <stdio.h>

int c = 3;

extern int add_x(int a, int b) __attribute__((section("l1_text")));

 

 

main()

{

int c;

c = add_x(1, 2);

printf("hello , c = %d \n", c);

}

 

Makefile:

 

CC=bfin-linux-uclibc-gcc

hello:

$(CC) -Wall -O2 -c hello_a.S

$(CC) -Wall -O2 -c hello.c

$(CC) -Wall -O2 -o hello hello_a.o hello.o -Wall

 

and when i make this program

 

the log:

 

warning:warning:relocation references a different segment

 

 

when i remove

 

.extern _c;

 

I can make it successful

 

why??

 

thanks

 

 

 

 

TranslateQuoteReplyEditDelete

 

 

2008-10-08 14:19:50     Re: bfin-linux-uclibc-??? build asm error???

Mike Frysinger (UNITED STATES)

Message: 63279   

 

your assembly code is incorrect for FDPIC.  please read the documentation:

http://docs.blackfin.uclinux.org/doku.php?id=simple_hello_world_application_example_asm

http://docs.blackfin.uclinux.org/doku.php?id=application_binary_interface

Attachments

    Outcomes