Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2011 11:02:23 +0200
From:      Jeremie Le Hen <jeremie@le-hen.org>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        kan@freebsd.org, freebsd-hackers@freebsd.org, Jeremie Le Hen <jeremie@le-hen.org>, "b. f." <bf1783@googlemail.com>, portmgr@freebsd.org
Subject:   Re: compiling ports with SSP
Message-ID:  <20110715090223.GA20572@felucia.tataz.chchile.org>
In-Reply-To: <20110602100617.GF48734@deviant.kiev.zoral.com.ua>
References:  <20100920162925.GL6864@felucia.tataz.chchile.org> <20100920192708.GK2389@deviant.kiev.zoral.com.ua> <20100927094651.GB57265@felucia.tataz.chchile.org> <20100927154457.GJ43070@deviant.kiev.zoral.com.ua> <20101005181804.GJ7536@felucia.tataz.chchile.org> <20101105213905.GT30284@felucia.tataz.chchile.org> <20101105190023.29e5d39d@kan.dnsalias.net> <20101106194702.GN2392@deviant.kiev.zoral.com.ua> <20110601214723.GD53247@felucia.tataz.chchile.org> <20110602100617.GF48734@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--adJ1OR3c6QgCpb/j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi Kostik, Alexander,

I've Cc'ed portmgr@ because once this patch will reach the tree, I think
we will be ready to enable -fstack-protector for ports.

On Thu, Jun 02, 2011 at 01:06:17PM +0300, Kostik Belousov wrote:
> > > > > 
> > > > > I dare to remind you about my patch.  Do you have any other concerns?
> > > > > 
> > > > > Thanks.
> > > > > Regards,
> > > > > -- 
> > > > > Jeremie Le Hen
> > > > 
> > > > Hmm, I thought I did approve this patch already a long time agi, but
> > > > since you asked:
> > > > 
> > > > +.if defined(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT})
> > > > 
> > > > this should be:
> > > > 
> > > > +.if defined(SHLIB_LDSCRIPT)
> > > > 
> > > > ditto for all other similar places. Otherwise I do not think we should
> > > > hold the patch in queue ans should unleash it on unsuspecting public.
> > > 
> > > Also, I think the "DEBUG" lines should be removed.
> > 
> > Sure, I'll do it in my next update.
> > 
> > > You install the libxxx.ld and then symlink libxxx.so to libxxx.ld.
> > > Why ? Would it be enough to install just the libxxx.so ?
> > 
> > I just thought it would be less puzzling for users than noticing that
> > libc.so is only a few hundred of ascii.  I don't have a strong opinion
> > about this though.
> I prefer to not have a symlink.
> 
> > 
> > > Otherwise, I think you need the similar
> > > .if ${SHLIBDIR} == ${LIBDIR}
> > > magic, that is better to be avoided.
> > 
> > Can you explain a little bit more about this one please?  I'm willing to
> > post an updated patch for further review. 
> I think this comment was somehow related to the fact that make install
> does not work from the buildenv, or something similar.
> It was too long time ago for me to remember details.
> 
> Also, I remember there was a concern about linker script not being
> installed in the cross-build environment during buildworld, or something
> close to what I stated. Was it resolved ?
> 
> [I pinged you some time ago, you did not responded].

I finally found some time to finish my patch.  There was a few things to
fix to be able to compile 32 bits library shims.  I've also removed the
symlink to libc.ld (which is installed directly as libc.so now).

Now you have the following:

 % # ls -l lib*/libc.*
 % -r--r--r--  1 root  wheel  3650256 Jul 15 09:09 lib/libc.a
 % -r--r--r--  1 root  wheel       68 Jul 15 09:09 lib/libc.so
 % -r--r--r--  1 root  wheel  2472468 Jul 15 09:16 lib32/libc.a
 % -r--r--r--  1 root  wheel       76 Jul 15 09:16 lib32/libc.so
 % -r--r--r--  1 root  wheel  1277960 Jul 15 09:16 lib32/libc.so.7
 % # cat lib/libc.so
 % /* $FreeBSD */
 % GROUP ( /lib/libc.so.7 /usr/lib/libssp_nonshared.a )
 % # cat lib32/libc.so
 % /* $FreeBSD */
 % GROUP ( /usr/lib32/libc.so.7 /usr/lib32/libssp_nonshared.a )

Thanks.
Best regards,
-- 
Jeremie Le Hen

Humans are born free and equal.  But some are more equal than others.
					    Coluche

--adJ1OR3c6QgCpb/j
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="ld_ssp_nonshared.diff"

diff -urNp -x '*.orig' -x 'typescript*' -x '*.swp' -x BEASTIE /usr/src.HEAD_20111506/lib/libc/Makefile /usr/src/lib/libc/Makefile
--- /usr/src.HEAD_20111506/lib/libc/Makefile	2011-02-25 01:04:39.000000000 +0100
+++ /usr/src/lib/libc/Makefile	2011-06-25 14:17:05.000000000 +0200
@@ -30,6 +30,7 @@ CFLAGS+=-DNLS
 CLEANFILES+=tags
 INSTALL_PIC_ARCHIVE=
 PRECIOUSLIB=
+SHLIB_LDSCRIPT=libc.ldscript
 
 .ifndef NO_THREAD_STACK_UNWIND
 CANCELPOINTS_CFLAGS=-fexceptions
diff -urNp -x '*.orig' -x 'typescript*' -x '*.swp' -x BEASTIE /usr/src.HEAD_20111506/lib/libc/libc.ldscript /usr/src/lib/libc/libc.ldscript
--- /usr/src.HEAD_20111506/lib/libc/libc.ldscript	1970-01-01 01:00:00.000000000 +0100
+++ /usr/src/lib/libc/libc.ldscript	2011-07-14 17:02:29.000000000 +0200
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+GROUP ( @@SHLIB@@ @@LIBDIR@@/libssp_nonshared.a )
diff -urNp -x '*.orig' -x 'typescript*' -x '*.swp' -x BEASTIE /usr/src.HEAD_20111506/share/mk/bsd.lib.mk /usr/src/share/mk/bsd.lib.mk
--- /usr/src.HEAD_20111506/share/mk/bsd.lib.mk	2011-04-19 20:09:21.000000000 +0200
+++ /usr/src/share/mk/bsd.lib.mk	2011-07-14 22:36:02.000000000 +0200
@@ -282,6 +282,13 @@ _libinstall:
 	    ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
 	    ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
 .if defined(SHLIB_LINK)
+.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT})
+	sed -e 's,@@SHLIB@@,${SHLIBDIR}/${SHLIB_NAME},g' \
+	    -e 's,@@LIBDIR@@,${LIBDIR},g' \
+	    ${.CURDIR}/${SHLIB_LDSCRIPT} > lib${LIB}.ld
+	${INSTALL} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+	    ${_INSTALLFLAGS} lib${LIB}.ld ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
+.else
 .if ${SHLIBDIR} == ${LIBDIR}
 	ln -fs ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
 .else
@@ -292,8 +299,9 @@ _libinstall:
 	rm -f ${DESTDIR}${LIBDIR}/${SHLIB_NAME}
 .endif
 .endif
-.endif
-.endif
+.endif # SHLIB_LDSCRIPT
+.endif # SHLIB_LINK
+.endif # SHIB_NAME
 .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
 	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
 	    ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
@@ -361,6 +369,9 @@ clean:
 .endif
 .if defined(SHLIB_NAME)
 .if defined(SHLIB_LINK)
+.if defined(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT})
+	rm -f lib${LIB}.ld
+.endif
 	rm -f ${SHLIB_LINK}
 .endif
 .if defined(LIB) && !empty(LIB)

--adJ1OR3c6QgCpb/j--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110715090223.GA20572>