> +#define ASM_LONG "\t.long\t"

Do not replicate targetm.asm_out.aligned_op.si, or integer_asm_op, really.

> +aarch64_file_end_indicate_exec_stack ()
> +{
> +  file_end_indicate_exec_stack ();
> +
> +  if (!aarch64_bti_enabled ()
> +      && aarch64_ra_sign_scope == AARCH64_FUNCTION_NONE)
> +    {
> +      return;
> +    }

This is redundant with...

> +
> +  unsigned feature_1_and = 0;
> +  if (aarch64_bti_enabled ())
> +    feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI;
> +
> +  if (aarch64_ra_sign_scope != AARCH64_FUNCTION_NONE)
> +    feature_1_and |= GNU_PROPERTY_AARCH64_FEATURE_1_PAC;
> +
> +  if (feature_1_and)

... this.  I prefer the second, as it's obvious.

> +      ASM_OUTPUT_ALIGN (asm_out_file, p2align);
> +      /* name length.  */
> +      fprintf (asm_out_file, ASM_LONG " 1f - 0f\n");
> +      /* data length.  */
> +      fprintf (asm_out_file, ASM_LONG " 4f - 1f\n");
> +      /* note type: NT_GNU_PROPERTY_TYPE_0.  */
> +      fprintf (asm_out_file, ASM_LONG " 5\n");
> +      fprintf (asm_out_file, "0:\n");
> +      /* vendor name: "GNU".  */
> +      fprintf (asm_out_file, STRING_ASM_OP " \"GNU\"\n");
> +      fprintf (asm_out_file, "1:\n");
> +      ASM_OUTPUT_ALIGN (asm_out_file, p2align);
> +      /* pr_type: GNU_PROPERTY_AARCH64_FEATURE_1_AND.  */
> +      fprintf (asm_out_file, ASM_LONG " 0x%x\n",
> +            GNU_PROPERTY_AARCH64_FEATURE_1_AND);
> +      /* pr_datasz.  */\
> +      fprintf (asm_out_file, ASM_LONG " 3f - 2f\n");
> +      fprintf (asm_out_file, "2:\n");
> +      /* GNU_PROPERTY_AARCH64_FEATURE_1_XXX.  */
> +      fprintf (asm_out_file, ASM_LONG " 0x%x\n", feature_1_and);
> +      fprintf (asm_out_file, "3:\n");
> +      ASM_OUTPUT_ALIGN (asm_out_file, p2align);
> +      fprintf (asm_out_file, "4:\n");

This could stand to use a comment, a moment's thinking about the sizes, and to
use the existing asm output functions.

        /* PT_NOTE header: namesz, descsz, type.
           namesz = 4 ("GNU\0")
           descsz = 12 (see below)
           type   = 5 (NT_GNU_PROPERTY_TYPE_0).  */
        assemble_align (POINTER_SIZE);
        assemble_integer (GEN_INT (4), 4, 32, 1);
        assemble_integer (GEN_INT (12), 4, 32, 1);
        assemble_integer (GEN_INT (5), 4, 32, 1);

        /* PT_NOTE name */
        assemble_string ("GNU", 4);

        /* PT_NOTE contents for NT_GNU_PROPERTY_TYPE_0:
           type   = 0xc0000000 (GNU_PROPERTY_AARCH64_FEATURE_1_AND),
           datasz = 4
           data   = feature_1_and
           Note that the current section offset is 16,
           and there has been no padding so far.  */
        assemble_integer (GEN_INT (0xc0000000), 4, 32, 1);
        assemble_integer (GEN_INT (4), 4, 32, 1);
        assemble_integer (GEN_INT (feature_1_and), 4, 32, 1);

        /* Pad the size of the note to the required alignment. */
        assemble_align (POINTER_SIZE);


r~

Reply via email to