Here is the code
//hello.c
char* str = "Hello world!\n";
void print()
{
    asm(
        "mov $13, %%rdx \n\t"
        "mov %0,  %%rcx \n\t"
        "mov $0,  %%rbx \n\t"
        "mov $4,  %%rax \n\t"
        "int $0x80       \n\t"
        ::"r"(str):"rdx","rcx","rbx");
}
void exit()
{
    asm(
        "mov $42, %rbx \n\t"
        "mov $1,  %rax \n\t"
        "int $0x80      \n\t"
    );
}
void hello()
{
    print();
    exit();
}
And here is the link script hello.lds
ENTRY(hello)
SECTIONS
{
    . = 0X08048000 + SIZEOF_HEADERS;
    
    tinytext : {*(.text) *(.data) *(.rodata)}
    
    /DISCARD/ : {*(.comment)}
}
I use the following command to compile and build an ELF file, and I want to combine .text, .data and .rodata to one .tinytext, what's more, I want to discard .comment.
gcc -c -fno-builtin hello.c
ld -static -T hello.lds -o hello hello.o
But the thing is that this can not work, when using objdump or readelf, I find the .text .data and .rodata still exist. What's more, the ELF file size enlarged from 1.6KB to 296KB(What I intended for is that the size may be less than 1KB).
Is there any problem of my operation?
And when I change the addr from 0x08048000 to 0x00000000, I find the size decrease from 296KB to a relatively small size like 1.1KB, can anyone explain it?
Thanks for any help.
