Dear Programmers and Experts. Currently I am learning assembly programming on 64-bit architecture with AT&T syntax. I was acquiring knowledge on Data Records. I was learning to add strings to my data record. And I learned two ways to add strings in data records. First one was easy but in second method the example in the book used pointers.
Let me just clarify it a bit.
The data record
people:
.quad $gkcname, 200, 8, 12, 75, 34
.quad $jbname, 200, 8, 12, 75, 34
.quad $taname, 200, 8, 12, 75, 34
.quad $inname, 200, 8, 12, 75, 34
.quad $gmname, 200, 8, 12, 75, 34
endpeople:
The limitations with the first method were these. First it was limiting the size of string because we need to declare the fixed length of string before the string and secondly if the string is shorter than fixed size length then storage was wasted. So, the second method overcomes these issues by storing the strings somewhere else in memory and then taking references to these strings in data record.
strings
gkcname:
.ascii “Gilbert Keith Clevester”
and similarly, we have other strings. $gkcname, $jbname, etc these all are pointers correspond to these strings. When I am linking this the error I am getting is as follows
error
in function people': (.data+0x8): undefined reference to
$gkcname’
ld: (.data+0x38): undefined reference to $jbname' ld: (.data+0x68): undefined reference to
$cslname’
ld: (.data+0x98): undefined reference to $taname' ld: (.data+0xc8): undefined reference to
$inname’
ld: (.data+0xf8): undefined reference to `$gmname’
I tried a lot to get something in regards of this but unfortunately, I failed.
Any suggestions or any help will be greatly appreciated. Many thanks to stack overflow community.
Bilal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.