Tcl Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to
or submit via the online form by Aug 20.
Ticket UUID: 4f51e1c5dcf75de22f5907f7b66361e4bcab02e2
Title: patch to correct linker flag sequence
Type: Bug Version: 8.6
Submitter: jan.nijtmans Created on: 2017-11-17 08:29:19
Subsystem: 53. Configuration and Build Tools Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2017-12-22 09:11:26
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2017-12-22 09:11:26
 This patch will correct the sequence of -pie and -shared options.
 When used together, -pie should be provided to the linker before
 -shared. If -pie is provided after -shared, the linker throws an
 error shown below as example.

 undefined reference to `main'
collect2: error: ld returned 1 exit status
make[2]: *** [] Error 1

Signed-off-by: Jay Shah <>
Signed-off-by: Matt Weber <>
 unix/tcl.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 9aa3eb2..4d8182e 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1394,7 +1394,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
            # get rid of the warnings.

-           SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
+           SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
            LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
User Comments: jan.nijtmans added on 2017-12-22 09:11:26:
Merged to core-8-6-branch and up.