On Fri, 2021-12-10 at 15:43 +0800, Chenghua Xu wrote:
> +#undef TARGET_ASM_CODE_END
> +#define TARGET_ASM_CODE_END loongarch_code_end
/* snip */
> +static void
> +loongarch_code_end (void)
> +{
> + if (NEED_INDICATE_EXEC_STACK)
> + /* Add .note.GNU-stack. */
> + file_end_indicate_exec_stack ();
> +}
> +
Hi Chenghua,
I think this should be put into TARGET_ASM_FILE_END (like how MIPS and
ARM port do this) instead of TARGET_ASM_CODE_END.
Consider compiling a "hello world" program with -flto -g:
$ loongarch64-linux-gnu-gcc hw.c -flto -g
During the LTO pass, a file containing debug info named "a-
hw.o.debug.temp.o" is created. This file does not contain any code.
But .note.GNU-stack should still be emitted into it, or when it's linked
into a.out, a.out will have executable stack which is bad for security.
Now I get 650 files in /usr/bin with executable stack in my 5th Linux
>From Scratch build on LoongArch! Will start over and do 6th.
--
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University