Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1 | From 1735a78561dbe139fd138caef2d44d81f5494fe7 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Tue, 4 Apr 2023 12:28:11 -0700 |
| 4 | Subject: [PATCH] Make function checks more robust within shared libs |
| 5 | |
| 6 | Previous attempt to error at link like was with |
| 7 | |
| 8 | https://github.com/toddr/IO-Tty/commit/1747cdf9f98cfd3aada9bf6c09f9d46297e18a5e |
| 9 | |
| 10 | this however causes issues with newer clang where it detects |
| 11 | the assignment as -Wint-conversion warning which is treated at error |
| 12 | and builds with clang fail. So this is an attempt to instruct |
| 13 | linker explicitly to error out if the symbol is not found during link |
| 14 | time when building a shared library, this fixes both the problems |
| 15 | as reported in |
| 16 | |
| 17 | https://github.com/toddr/IO-Tty/issues/23 |
| 18 | |
| 19 | as well as |
| 20 | |
| 21 | https://github.com/toddr/IO-Tty/pull/33#issuecomment-1260147256 |
| 22 | |
| 23 | Upstream-Status: Submitted [https://github.com/toddr/IO-Tty/pull/33] |
| 24 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 25 | --- |
| 26 | Makefile.PL | 5 +++-- |
| 27 | 1 file changed, 3 insertions(+), 2 deletions(-) |
| 28 | |
| 29 | diff --git a/Makefile.PL b/Makefile.PL |
| 30 | index eaf47e0..2e8338d 100644 |
| 31 | --- a/Makefile.PL |
| 32 | +++ b/Makefile.PL |
| 33 | @@ -163,7 +163,8 @@ main () |
| 34 | #if defined (__stub_$f) || defined (__stub___$f) |
| 35 | choke me |
| 36 | #else |
| 37 | -f = $f (); |
| 38 | +f = $f; |
| 39 | +f(); |
| 40 | #endif |
| 41 | |
| 42 | ; |
| 43 | @@ -173,7 +174,7 @@ ESQ |
| 44 | |
| 45 | close(TST); |
| 46 | print "Looking for $f()" . "." x (13-length($f)) . " "; |
| 47 | - if (system("$cfg{'cc'} $flags $funcs{$f} functest_$f.c > functest_$f.log 2>&1")) { |
| 48 | + if (system("$cfg{'cc'} $flags -Wl,--no-undefined $funcs{$f} functest_$f.c > functest_$f.log 2>&1")) { |
| 49 | print "not found.\n"; |
| 50 | } else { |
| 51 | $define{"-DHAVE_\U$f"} = undef; |
| 52 | -- |
| 53 | 2.40.0 |
| 54 | |