Re: [PATCH dwarves v2 3/3] btf_encoder: Set .BTF section alignment to 16

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Thu, Jan 21, 2021 at 11:35:20AM +0000, Giuliano Procida escreveu:
> NOTE: Do not apply. I will try to eliminate the dependency on objcopy
> instead and achieve what's needed directly using libelf.

Ok, so I'll wait for the right fix.

Thanks for working on this!

- Arnaldo
 
> This is to avoid misaligned access when memory-mapping ELF sections.
> 
> Signed-off-by: Giuliano Procida <gprocida@xxxxxxxxxx>
> ---
>  libbtf.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libbtf.c b/libbtf.c
> index 7552d8e..2f12d53 100644
> --- a/libbtf.c
> +++ b/libbtf.c
> @@ -797,6 +797,14 @@ static int btf_elf__write(const char *filename, struct btf *btf)
>  			goto unlink;
>  		}
>  
> +		snprintf(cmd, sizeof(cmd), "%s --set-section-alignment .BTF=16 %s",
> +			 llvm_objcopy, filename);
> +		if (system(cmd)) {
> +			/* non-fatal, this is a nice-to-have and it's only supported from LLVM 10 */
> +			fprintf(stderr, "%s: warning: failed to align .BTF section in '%s': %d!\n",
> +				__func__, filename, errno);
> +		}
> +
>  		err = 0;
>  	unlink:
>  		unlink(tmp_fn);
> -- 
> 2.30.0.296.g2bfb1c46d8-goog
> 

-- 

- Arnaldo



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux