* ld "undefined reference" shows wrong line number
@ 2011-06-20 11:13 Jon Grant
2011-06-21 15:12 ` Nick Clifton
0 siblings, 1 reply; 3+ messages in thread
From: Jon Grant @ 2011-06-20 11:13 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 902 bytes --]
Hello
I noticed in a version of the tools I am using that the output from ld
shows the wrong line number for an "undefined reference". as my tools
are not so recent (codesourcery), would someone be able to confirm if
this issue is reproducable if possible please.
The line number 19 is the last symbol in the start.S. void main(void)
function does exist in the build as well. Possibly is this the debug
info that is incorrect in the start.o file?
I attach my sample assembler file, which is for ARM.
Let me know if you would like me to create a bugzilla ticket.
Best regards, Jon
./libtest.a(start.o): In function `go_main':
c:\test\start.S:19: undefined reference to `global_buffer'
collect2: ld returned 1 exit status
make: *** [test.elf] Error 1
C:\>arm-none-eabi-ld --version
GNU ld (Sourcery G++ Lite 2010.09-51) 2.20.51.20100809
arm-none-eabi-gcc (Sourcery G++ Lite 2010.09-51) 4.5.1
[-- Attachment #2: start.S --]
[-- Type: application/octet-stream, Size: 230 bytes --]
.global entrypoint
entrypoint:
LDR PC,=test
LDR PC,=test
LDR PC,=test
LDR PC,=test
LDR PC,=test
LDR PC,=test
test:
LDR R1,=global_buffer
go_main:
LDR PC, =main
NOP
LDR PC, =main
.END
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ld "undefined reference" shows wrong line number
2011-06-20 11:13 ld "undefined reference" shows wrong line number Jon Grant
@ 2011-06-21 15:12 ` Nick Clifton
2011-07-11 2:06 ` Jon Grant
0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2011-06-21 15:12 UTC (permalink / raw)
To: Jon Grant; +Cc: binutils
Hi Jon,
> would someone be able to confirm if
> this issue is reproducable if possible please.
Not with the information you provided. In particular we need the
command line to assemble the start.S file and the command line used to
link it afterwards.
> The line number 19 is the last symbol in the start.S. void main(void)
> function does exist in the build as well. Possibly is this the debug
> info that is incorrect in the start.o file?
Very probably.
> Let me know if you would like me to create a bugzilla ticket.
Yes please. Please include the start.S file as well as the command
lines mentioned above.
Cheers
Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
* ld "undefined reference" shows wrong line number
2011-06-21 15:12 ` Nick Clifton
@ 2011-07-11 2:06 ` Jon Grant
0 siblings, 0 replies; 3+ messages in thread
From: Jon Grant @ 2011-07-11 2:06 UTC (permalink / raw)
To: Nick Clifton; +Cc: binutils
Hi Nick
Thank you for your reply.
On 21 June 2011 16:13, Nick Clifton <nickc@redhat.com> wrote:
> Hi Jon,
>
>> would someone be able to confirm if
>> this issue is reproducable if possible please.
>
> Not with the information you provided. In particular we need the command
> line to assemble the start.S file and the command line used to link it
> afterwards.
Sorry, I should have provided more info.
I have created a ticket:
http://sourceware.org/bugzilla/show_bug.cgi?id=12974
Cmd line:
arm-none-eabi-gcc -g start.S main.c -o test.elf
^ Note the -g is necessary to see line numbers rather than assembler
hex refs in the outout. I expect you already knew this though!
>> The line number 19 is the last symbol in the start.S. void main(void)
>> function does exist in the build as well. Possibly is this the debug
>> info that is incorrect in the start.o file?
>
> Very probably.
>
>> Let me know if you would like me to create a bugzilla ticket.
>
> Yes please. Please include the start.S file as well as the command lines
> mentioned above.
I've attached a zip to the bug ticket 12974 with the start.S and command line.
Thank you for taking a look.
Best regards, Jon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-10 11:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-20 11:13 ld "undefined reference" shows wrong line number Jon Grant
2011-06-21 15:12 ` Nick Clifton
2011-07-11 2:06 ` Jon Grant
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).