-fleading-underscore is not working as expected.

2014-04-02 Thread Umesh Kalappa
Dear All ,

Was enabled the switch  -fleading-underscore  to emit the global
symbol name with prefix _ .

The respective C source file

int a=10;

int b=10,c;

int test()

{

c =a+b ;

tes();

return c ;

}

and respective asm file

.global _a

.section.data

.align  1

.type   _a, %object

.size   _a, 2

_a:

.word   10

.global _b

.align  1

.type   _b, %object

.size   _b, 2

_b:

.word   10

.comm   _c, 2,2

.section.text

.align  1

.global _test

.type   _test, %function

_test:

ld  HL, (a)

ld  DE, (b)

add DE, HL

ld  (c), DE

cal _tes

ld  DE, (c)

ld  WA, DE

ret


if you see the asm ,the global symbol names was prefixed with _ in the
definition ,But not in the uses.

I'm sure we are missing something here w.r.t -fleading-underscore flag
and gcc source is 4.8.1.

Any help will be appreciated here .

Thank you
~Umesh


Re: -fleading-underscore is not working as expected.

2014-04-02 Thread Ian Lance Taylor
On Wed, Apr 2, 2014 at 2:15 AM, Umesh Kalappa umesh.kalap...@gmail.com wrote:

 Was enabled the switch  -fleading-underscore  to emit the global
 symbol name with prefix _ .

 ld  HL, (a)

 ld  DE, (b)

 add DE, HL

 ld  (c), DE

 cal _tes

 ld  DE, (c)

 ld  WA, DE

 ret


 if you see the asm ,the global symbol names was prefixed with _ in the
 definition ,But not in the uses.

 I'm sure we are missing something here w.r.t -fleading-underscore flag
 and gcc source is 4.8.1.

You didn't mention which target you are using, and I don't recognize
it.  If this is a private target, your backend files are missing some
uses of %U (%U is a directive for asm_fprintf).

Ian