Re: git: 2f3a961487c9 - main - Add RELRO build knob, default to enabled

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 24 Jun 2022 01:23:09 UTC
On 6/22/22 9:20 AM, Ed Maste wrote:
> The branch main has been updated by emaste:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=2f3a961487c97dc879f07bb97bc62d7bd70b3f8d
> 
> commit 2f3a961487c97dc879f07bb97bc62d7bd70b3f8d
> Author:     Ed Maste <emaste@FreeBSD.org>
> AuthorDate: 2022-06-22 12:58:04 +0000
> Commit:     Ed Maste <emaste@FreeBSD.org>
> CommitDate: 2022-06-22 16:18:41 +0000
> 
>      Add RELRO build knob, default to enabled
>      
>      Note that lld enables relro by default, so that we already had either
>      partial or full RELRO, depending on the state of the BIND_NOW knob.
>      
>      Add a RELRO knob so that the option can be disabled if desired, and so
>      that builds using the GNU toolchain are equivalent to those using the
>      standard Clang/LLVM toolchain.
>      
>      Reviewed by:    markj
>      MFC after:      3 weeks
>      Sponsored by:   The FreeBSD Foundation
>      Differential Revision:  https://reviews.freebsd.org/D35545

This broke the cross-build on macOS (the GitHub jobs are failing on main now).

Looks like macOS's linker doesn't like '-z relro'.

996 --------------------------------------------------------------
997 >>> stage 1.2: bootstrap tools
998 --------------------------------------------------------------
999 ===> lib/clang/libllvmminimal (obj,all,install)
1000 ===> usr.bin/fortune/strfile (obj,all,install)
1001 ===> usr.bin/dtc (obj,all,install)
1002 warning: unknown warning option '-Werror=unused-but-set-variable'; did you mean '-Werror=unused-const-variable'? [-Wunknown-warning-option]
1003 warning: unknown warning option '-Werror=unused-but-set-variable'; did you mean '-Werror=unused-const-variable'? [-Wunknown-warning-option]
1004 warning: unknown warning option '-Werror=unused-but-set-variable'; did you mean '-Werror=unused-const-variable'? [-Wunknown-warning-option]
1005 1 warning generated.
1006 ld: unknown option: -zrelro
1007 clang: error: linker command failed with exit code 1 (use -v to see invocation)
1008 --- strfile ---
1009 *** [strfile] Error code 1

-- 
John Baldwin