For example, I've seen _start
as .global _start
and .globl _start
. It seems like I can just use them interchangeably. Is there any difference between the two?
.global is an assembler directive that marks the symbol as global in the ELF file. The ELF file contains some metadata for every symbol, indicating its visibility.
global main basically means that the symbol should be visible to the linker because other object files will use it. Without it, the symbol main is considered local to the object file it's assembled to, and will not appear after the assembly file is assembled.
In your case, . globl is an assembler directive that tells the assembler that the main symbol will be accessible from outside the current file (that is, it can be referenced from other files), and . ent is a debugger (pseudo) operation that marks the entry of main .
Globalstar, Inc. is an American satellite communications company that operates a low Earth orbit (LEO) satellite constellation for satellite phone and low-speed data communications. The Globalstar second-generation constellation consists of 24 low Earth orbiting (LEO) satellites. Globalstar, Inc. Type. Public.
They are the same. In fact, the LLVM assembler in MCParser/AsmParser.cpp lexes them as DK_GLOBL and DK_GLOBAL
DirectiveKindMap[".globl"] = DK_GLOBL;
DirectiveKindMap[".global"] = DK_GLOBAL;
but then parses them as the same attribute.
case DK_GLOBL:
case DK_GLOBAL:
return parseDirectiveSymbolAttribute(MCSA_Global);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With