blob: 13a9e3b884984ebbf9091402da550adc61283e26 [file] [log] [blame]
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001From 1735a78561dbe139fd138caef2d44d81f5494fe7 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 4 Apr 2023 12:28:11 -0700
4Subject: [PATCH] Make function checks more robust within shared libs
5
6Previous attempt to error at link like was with
7
8https://github.com/toddr/IO-Tty/commit/1747cdf9f98cfd3aada9bf6c09f9d46297e18a5e
9
10this however causes issues with newer clang where it detects
11the assignment as -Wint-conversion warning which is treated at error
12and builds with clang fail. So this is an attempt to instruct
13linker explicitly to error out if the symbol is not found during link
14time when building a shared library, this fixes both the problems
15as reported in
16
17https://github.com/toddr/IO-Tty/issues/23
18
19as well as
20
21https://github.com/toddr/IO-Tty/pull/33#issuecomment-1260147256
22
23Upstream-Status: Submitted [https://github.com/toddr/IO-Tty/pull/33]
24Signed-off-by: Khem Raj <raj.khem@gmail.com>
25---
26 Makefile.PL | 5 +++--
27 1 file changed, 3 insertions(+), 2 deletions(-)
28
29diff --git a/Makefile.PL b/Makefile.PL
30index 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--
532.40.0
54