Re: [PATCH v2 2/2] tools: ynl: extend CFLAGS to keep options from environment
From: Donald Hunter
Date: Tue Nov 12 2024 - 04:51:02 EST
Jan Stancek <jstancek@xxxxxxxxxx> writes:
> Package build environments like Fedora rpmbuild introduced hardening
> options (e.g. -pie -Wl,-z,now) by passing a -spec option to CFLAGS
> and LDFLAGS.
>
> ynl Makefiles currently override CFLAGS but not LDFLAGS, which leads
> to a mismatch and build failure:
> CC sample devlink
> /usr/bin/ld: devlink.o: relocation R_X86_64_32 against symbol `ynl_devlink_family' can not be used when making a PIE object; recompile with -fPIE
> /usr/bin/ld: failed to set dynamic section sizes: bad value
> collect2: error: ld returned 1 exit status
>
> Extend CFLAGS to support hardening options set by build environment.
>
> Signed-off-by: Jan Stancek <jstancek@xxxxxxxxxx>
> Acked-by: Jakub Kicinski <kuba@xxxxxxxxxx>
Reviewed-by: Donald Hunter <donald.hunter@xxxxxxxxx>