[cfe-dev] GNU assembler syntax for strlen

Eli Friedman eli.friedman at gmail.com
Tue Oct 16 13:20:41 PDT 2012


On Tue, Oct 16, 2012 at 11:14 AM, Andrew Pennebaker
<andrew.pennebaker at gmail.com> wrote:
>
>> msg: .asciz "Hello, world!\n"
>> .set len, . - msg
>>
>> foo:
>>         push $len
>
>
> That's odd, on my system this syntax fails to link.
>
> $ clang -c -o hello.o -arch i386 hello.s
> $ ld -o hello -macosx_version_min 10.6 -arch i386 hello.o
> $ ld: section __data (address=0x00002000, size=4294967279) would make the
> output executable exceed available address range for architecture i386
>
> Joerg, could you post a full hello.s file?

The following links, runs, and returns an exit code of 15 for me on OSX:

.data
msg: .asciz "Hello, world!\n"
.set len, . - msg

.text
.globl _main
_main:
        push $len
        pop %eax
        ret

-Eli



More information about the cfe-dev mailing list