On Tue, 10 May 2011, Bernd Schmidt wrote:

> Index: doc/tm.texi.in
> ===================================================================
> --- doc/tm.texi.in.orig
> +++ doc/tm.texi.in
> @@ -6976,6 +6976,12 @@ if function is in @code{.text.name}, and
>  otherwise.
>  @end deftypefn
>  
> +@hook TARGET_ASM_MERGEABLE_RODATA_PREFIX
> +Usually, the compiler uses the prefix @code{".rodata"} to construct section
> +names for mergeable constant data.  Define this macro to override the string
> +if a different section name should be used.
> +@end deftypevr

Unless the documentation is based on pre-existing GFDL-only documentation 
in tm.texi.in, it's preferable for the documentation of a new hook to go 
in the doc string in target.def and get to tm.texi that way, rather than 
putting it directly in tm.texi.in.  (So you'd put the @hook in tm.texi.in, 
but not the main body of the documentation for the hook.)

> +/* Nonnull if the target wants to override the default ".rodata" prefix
> +   for mergeable data sections.  */
> +DEFHOOKPOD
> +(mergeable_rodata_prefix,
> + "",
> + const char *, NULL)

A default of ".rodata" instead of NULL would seem to simplify the rest of 
the patch.

> -      char name[30];
> +      char name[80];

There seems to be some undocumented requirement on the maximum length of 
the string named by the hook, to avoid buffer overruns with these 
fixed-size buffers.  Consider using alloca (or asprintf to avoid needing 
to work out manually how much to add to the length of the string, but then 
you need to free things before returning) to avoid such an undocumented 
bound.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to