pascal strings in the gnu assembler

Adriaan van Os gpc at
Mon May 5 13:31:07 CEST 2008

steven.borley wrote:
> Hope this is not considered too off-topic as it about the gnu assemble 
> (gnu-as).  I beg forgiveness on grounds that's its Pascal related.
> In my assembly code I'm trying to place string constants in memory 
> (length byte followed by ASCII string with no trailing zero byte)
> The following is failing with "Error: illegal relocation size: 1"
> FOO:    .byte    ((BAR - . - 2) & 0x7F)    ; calculate length
>         .ascii    "foo"
> BAR:    .word    0x1234                ; dummy for this example
> I could just hard code the length, except I eventually want this as 
> macro as I have several hundred strings.  And unfortunately this part of 
> the code has to be in assembler, for various reasons.

This makes me curious to know those various reasons.


Adriaan van Os

More information about the Gpc mailing list