@@ -144,9 +144,9 @@ underscore, while on Linux you do not. So on a Mac, you would use the
144144names @tt{_entry}, @tt{_tri}, and @tt{_done}, while on Linux you would
145145use @tt{entry}, @tt{tri}, and @tt{done}.
146146
147- This example is shown using the @( if (eq? (system-type 'os ) 'macosx )
148- " MacOS " " Linux " ) naming convention, because that 's what operating
149- system was used when this web page was built .}
147+ Alternatively, you can impose the underscore naming convention by
148+ passing @tt{--gprefix _ } to @tt{nasm} ; this way you avoid having to
149+ write the underscores within the file .}
150150
151151@filebox-include[fancy-nasm a86 "tri.s " ]
152152
@@ -246,13 +246,15 @@ stack or use the @tt{call} instruction.}
246246We can compile the @tt{tri.s} assembly program to an object
247247file with @tt{nasm}:
248248
249- @margin-note{The format argument should be @tt{macho64} on
250- Mac OS and @tt{elf64} on Linux.}
249+ @margin-note{The format argument should be @tt{macho64} on macOS and
250+ @tt{elf64} on Linux. The @tt{--gprefix _ } argument should be given
251+ on macOS in order to follow the system's naming convention
252+ requirements.}
251253
252254@shellbox[
253255 (format "nasm -f ~a -o tri.o tri.s "
254256 (if (eq? 'macosx (system-type 'os ))
255- "macho64 "
257+ "macho64 --gprefix _ "
256258 "elf64 " ))]
257259
258260To run the object file , we will need to link with a small C program
@@ -407,10 +409,6 @@ program using nasm notation, called @racket[asm-display]. Calling
407409this function prints to the current output port, but it's also
408410possible to write the output to a file or convert it to a string.
409411
410- @margin-note{The @racket[asm-display] function knows what OS you are
411- using and adjusts the label naming convention to use underscores or
412- not, so that you don't have to worry about it.}
413-
414412@ex[
415413(asm-display (tri 36 ))
416414 ]
0 commit comments