I learn assembler(AT&T). I tried to write program to find the length of the biggest string in record. During linking with command
ld person-data-with-names-pointer.o find-longest-name.o -o longest
I got error
ld: person-data-with-names-pointer.o: in function `people':
(.data+0x55): undefined reference to `$john_silver'
ld: (.data+0x85): undefined reference to `$billy_bones'
ld: (.data+0xb5): undefined reference to `$black_beard'
ld: (.data+0xe5): undefined reference to `$dave_jones'
ld: (.data+0x115): undefined reference to `$jack_the_sparrow'
ld: (.data+0x145): undefined reference to `$genry_morgan'
full listing of person-data-with-names-pointer.s
.section .data
.global people, numpeople
numpeople:
# Calculate the number of people in array
.quad (endpeople - people)/PERSON_RECORD_SIZE
people:
.quad $john_silver, 200, 10, 2, 74, 20
.quad $billy_bones, 280, 14, 2, 74, 44
.quad $black_beard, 150, 8, 1, 68, 30
.quad $dave_jones, 250, 14, 3, 75, 24
.quad $jack_the_sparrow, 250, 10, 2, 70, 11
.quad $genry_morgan, 180, 11, 5, 69, 65
endpeople: # Marks the end of the array for calculation purposes
john_silver:
.ascii "John Silver\0"
billy_bones:
.ascii "Billy Bones\0"
black_beard:
.ascii "Black Beard\0"
dave_jones:
.ascii "Dave Jones\0"
jack_the_sparrow:
.ascii "Jack The Sparrow\0"
genry_morgan:
.ascii "Genry Morgan\0"
# Describes the components of the struct
.global NAME_PTR_OFFSET, WEIGHT_OFFSET, SHOE_OFFSET
.global HAIR_OFFSET, HEIGHT_OFFSET, AGE_OFFSET
.equ NAME_PTR_OFFSET, 0
.equ WEIGHT_OFFSET, 8
.equ SHOE_OFFSET, 16
.equ HAIR_OFFSET, 24
.equ HEIGHT_OFFSET, 32
.equ AGE_OFFSET, 40
# Total size of the struct
.global PERSON_RECORD_SIZE
.equ PERSON_RECORD_SIZE, 48
I was tried to move labels but nothing works. :(