Unknown pseudo-op: .global

assembly, macos

Solution

As you're compiling using OS/X you'll be using X-Code's ancient version of `as`. This means you'll have to put up with some slightly older syntax. This other answer covers some of these problems.

At very least you're going to need to replace `.global` with `.globl`. You can remove `.extern` as all symbols are treated as external by default. For the section definition you should consult the `gas` manual; I believe the assembler is asking you to define the section flags.

Problem

I'm trying to compile a simple operating system code we got on OS class. It works fine under Ubuntu but I'd like to compile it on OS X. The error I get is: ``` [compiling] arch/i386/arch/startup.S ... arch/i386/arch/startup.S:8:Unknown pseudo-op: .extern arch/i386/arch/startup.S:8:Rest of line ignored. 1st junk character valued 107 (k). arch/i386/arch/startup.S:11:Expected comma after segment-name arch/i386/arch/startup.S:13:Unknown pseudo-op: .global arch/i386/arch/startup.S:13:Rest of line ignored. 1st junk character valued 97 (a). ``` This is the source code of that file, and here is the makefile So if anyone have an idea what to do I would appreciate it :)

Original source

Related problems