Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From 87a698a21646b7ee620923ef5ffa9735471a8ddd Mon Sep 17 00:00:00 2001 |
| 2 | From: Fangrui Song <maskray@google.com> |
| 3 | Date: Tue, 4 Feb 2020 21:55:44 -0800 |
| 4 | Subject: [PATCH] Improve IFUNC check [BZ #25506] |
| 5 | |
| 6 | GNU ld's RISCV port does not support IFUNC. ld -no-pie produces no |
| 7 | relocation and the test passed incorrectly. Be more rigid by testing |
| 8 | IRELATIVE explicitly. |
| 9 | |
| 10 | Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=87a698a21646b7ee620923ef5ffa9735471a8ddd] |
| 11 | Tested-by: Aurelien Jarno <aurelien@aurel32.net> |
| 12 | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | --- |
| 15 | configure | 2 +- |
| 16 | configure.ac | 2 +- |
| 17 | 2 files changed, 2 insertions(+), 2 deletions(-) |
| 18 | |
| 19 | diff --git a/configure b/configure |
| 20 | index b959d2d988..3b98ec312f 100755 |
| 21 | --- a/configure |
| 22 | +++ b/configure |
| 23 | @@ -4035,7 +4035,7 @@ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ |
| 24 | -o conftest conftest.S 1>&5 2>&5; then |
| 25 | # Do a link to see if the backend supports IFUNC relocs. |
| 26 | $READELF -r conftest 1>&5 |
| 27 | - LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || { |
| 28 | + LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && { |
| 29 | libc_cv_ld_gnu_indirect_function=yes |
| 30 | } |
| 31 | fi |
| 32 | diff --git a/configure.ac b/configure.ac |
| 33 | index 49b900c1ed..e20034f301 100644 |
| 34 | --- a/configure.ac |
| 35 | +++ b/configure.ac |
| 36 | @@ -649,7 +649,7 @@ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ |
| 37 | -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then |
| 38 | # Do a link to see if the backend supports IFUNC relocs. |
| 39 | $READELF -r conftest 1>&AS_MESSAGE_LOG_FD |
| 40 | - LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || { |
| 41 | + LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && { |
| 42 | libc_cv_ld_gnu_indirect_function=yes |
| 43 | } |
| 44 | fi |
| 45 | -- |
| 46 | 2.25.1 |
| 47 | |