extern int shared;
int main() {
int a = 100;
swap(&a, &shared);
}
int shared = 1;
void swap(int *a, int *b) {
*a ^= *b ^= *a ^= *b;
}
char* str = "Hello World!\n";
void print()
{
asm("movq $13,%%rdx \n\t"
"movq %0,%%rcx \n\t"
"movq $0,%%rbx\n\t"
"movq $4,%%rax \n\t"
"int $0x80 \n\t"
::"r"(str):"rdx","rcx","rbx");
}
void exit()
{
asm("movq $42,%rbx \n\t"
"movq $1,%rax \n\t"
"int $0x80 \n\t"
);
}
void nomain()
{
print();
exit();
}
ENTRY(nomain)
SECTIONS
{
. = 0x08048000 + SIZEOF_HEADERS;
tinytext : { *(.text) *(.data) *(.rodata)}
/DISCARD/ :{ *(.comment) *(.eh_frame) *(.shstrtab) *(.symtab) *(.strtab)}
}