Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between .global and .globl?

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?

like image 706
Al Smith Avatar asked May 28 '18 14:05

Al Smith


People also ask

What does .global mean in assembly?

.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.

What is .global Main?

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.

What is .global and Main in MIPS?

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 .

What is Global_start?

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.


1 Answers

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);
like image 194
Olsonist Avatar answered Oct 14 '22 10:10

Olsonist