This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


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: equating symbols to undefined


>>> "H. J. Lu" <hjl@lucon.org> 10/14/05 9:31 PM >>>
>On Fri, Oct 14, 2005 at 12:27:42PM -0700, H. J. Lu wrote:
>> On Fri, Oct 14, 2005 at 11:58:43AM -0700, H. J. Lu wrote:
>> > On Fri, Oct 14, 2005 at 11:54:22AM -0700, H. J. Lu wrote:
>> > > On Fri, Oct 14, 2005 at 08:25:29PM +0200, Jan Beulich wrote:
>> > > > In what way does the sample sent not meet this? It matches
exactly the
>> > > > real situation that I having the problem with, only that I
added the
>> > > > __asm__(".global ..."); to show that making the symbol global
doesn't
>> > > > help. I specifically made that part contitional on a manifest
constant,
>> > > > so you can easily compare the two and see that making the
symbol global
>> > > > introduces a new problem, whereas not making the symbol global
causes an
>> > > 
>> > > Can you tell me what the new problem is? I got
>> > > 
>> > > [hjl@gnu-13 alias]$ make
>> > > cc  -c -o alias.o -save-temps alias.c
>> > > cc  -c -o main.o -save-temps main.c
>> > > cc  -c -o normal.o -save-temps normal.c
>> > > cc  -c -o user.o -save-temps user.c
>> > > cc -o tst alias.o main.o normal.o user.o
>> > > ./tst
>> > > copymem(0x500c00, 0x400700, 400)
>> > > copymem(0x500c00, 0x400700, 400)
>> > > 
>> > > I expect "make" fails if there is a problem.
>> > > 
>> > 
>> > Never mind. I figured it out.
>> 
>> Why does alias.c have to include alias.h? Specially, why does alias.c
>> have to have
>> 
>> __asm__(".equiv memcpy, copymem");
>> 
>
>It should be
>
>__asm__(".equiv memcpy, copymem");
>__asm__(".global memcpy");
>
>I don't think they have to be in alias.c.

alias.c has to include alias.h according to good programming practice,
and suppressing the __asm__-s (which indeed aren't necessary for
alias.c, but also [should] do no harm) would only clutter the header
file. Besides this or anything else, this problem is what I'd call a
classical regression (because it obviously worked and there was no
notion anywhere that this should not work).

And yes, as agreed to before, .alias would be a lot better suited for
this purpose, but we don't have it (yet).

Jan


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