How Do I Run the Assembly in OS X 10.11

Asked 1 months ago, Updated 1 months ago, 3 views

How do I run the assembly on OS X 10.11?
GCC seems to be able to assemble normally (gcc-o hello world hello world.s).
What should I do with clang?


I understood that there was a command in OS X called as, which seems to be a command for assembling.

Additional 2

as-arch x86_64-o helloworld helloworld.s generated a file called hellowworld, but I cannot successfully ld after that.
I tried ld-macosx_version_min 10.11 helloworld.
I get the following error

ld:warning:-macosx_version_min not specified,assuming 10.10
ld: warning: object file (helloworld) was built for newer OSX version (10.11) than being linked (10.10)
ld —dynamic main executables must link with libSystem.dylib for referred architecture x86_64

# original:

# #

hello_world:.asciz "Hello world!\n"


lea hello_world(%rip), %rsi
mov $14,%rdx
mov $0,%rdi


2022-09-30 13:51

1 Answers

How cc(1) runs ld(1) is

cc-v-o hello world hello world.s

You can check it by specifying the -v option.(Check the online documentation in ld(1) for the meaning of the individual options listed.)

Also, the resulting object files that are assembled in as(1) are usually

 as-arch x86_64-o helloworld.o helloworld.s

and .o filenames.

2022-09-30 13:51

If you have any answers or tips

© 2022 OneMinuteCode. All rights reserved.