commit:     8bb13b19b42601b8b57c5b1c2d64d1b0a04fede5
Author:     Alexander Miller <alex.miller <AT> gmx <DOT> de>
AuthorDate: Sat Aug  6 23:22:09 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug 24 04:56:27 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8bb13b19

sys-libs/compiler-rt: Override start symbol when adding -nostartfiles to LDFLAGS

Trying to link executables for the configure checks generates linker
warnings (in the CMake logs) like: "warning: cannot find entry symbol
_start; defaulting to 0000000000001000".
Moreover, with flags like -flto or -Wl,--gc-sections, the linker can
discard all code, rendering the checks useless.

Set main as entry symbol when linking with -nostartfiles to avoid
both issues. (Note that the binaries would still crash, but that
doesn't matter since they are never executed.)

Bug: https://bugs.gentoo.org/862540
Closes: https://bugs.gentoo.org/862798
Signed-off-by: Alexander Miller <alex.miller <AT> gmx.de>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild 
b/sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild
index 4ce8bbb484a7..c006ccddc481 100644
--- a/sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild
+++ b/sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild
@@ -88,8 +88,9 @@ src_configure() {
                        local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
                        ewarn "${CC} seems to lack runtime, trying with 
${nolib_flags[*]}"
                elif test_compiler "${nolib_flags[@]}" -nostartfiles; then
-                       # Avoiding -nostartfiles earlier on for bug #862540
-                       nolib_flags+=( -nostartfiles )
+                       # Avoiding -nostartfiles earlier on for bug #862540,
+                       # and set available entry symbol for bug #862798.
+                       nolib_flags+=( -nostartfiles -emain )
                        local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
                        ewarn "${CC} seems to lack runtime, trying with 
${nolib_flags[*]}"
                fi

Reply via email to