This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [M68K] Fix relocation overflow on ColdFire


On 08/25/2010 10:41 AM, Maxim Kuvyrkov wrote:
>  #define SYSCALL_ERROR_LOAD_GOT(reg)					      \
> -    move.l #_GLOBAL_OFFSET_TABLE_@GOTPC, reg;				      \
> +    move.l ##_GLOBAL_OFFSET_TABLE_@GOTPC, reg;				      \

Both of these are wrong.  # is a stringification operator, 
and ## is a concatenation operator.

To generate a raw # in a preprocessor macro is tricky.
You have to use an intermediary macro, e.g.

#define HASH #
#define SYSCALL_ERROR_LOAD_GOT(reg) \
  move.l HASH _GLOBAL_OFFSET_TABLE_@GOTPC, reg; \
  ...

and it better be valid assembler to leave a space after the #,
because you can't actually concatenate them without generating

  error: pasting "#" and "foo" does not give a valid preprocessing token


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]