Time to enable partial relro

2016-08-25 Thread Pedro Giffuni

Hello;

GNU RELRO support was committed in r230784 (2012-01-30) but we never 
enabled it by default.


There was some discussion about it on
https://reviews.freebsd.org/D3001

By now, all Linux distributions, NetBSD and DragonFly support it and
it is the default for most systems in binutils 2.27.

This doesn't affect performance, I ran it through an exp-run last
year, no other OS has had issues etc ... seems safe and can be
disabled if needed when linking.

I think it's time to enable it be default in our base binutils. If
there are no objections, I will just commit the attached patch over
the weekend.

Regards,

Pedro.
Index: contrib/binutils/ld/emultempl/elf32.em
===
--- contrib/binutils/ld/emultempl/elf32.em	(revision 304807)
+++ contrib/binutils/ld/emultempl/elf32.em	(working copy)
@@ -97,6 +97,7 @@
   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
   config.dynamic_link = ${DYNAMIC_LINK-TRUE};
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
+  link_info.relro = TRUE;
 }
 
 EOF
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"

Re: name conflict after upgrade to HEAD.

2016-08-25 Thread Dimitry Andric
On 24 Aug 2016, at 16:30, Willem Jan Withagen  wrote:
> 
> On 24-8-2016 15:23, Dimitry Andric wrote:
...
>> Can you show the full command line used to build the offending source
>> file?  Usually this is caused by an incorrect include directory search
>> order.  And most often, that is caused by build systems inserting
>> -isystem into compile command lines.
> 
> This is the full output of the failing compile
> 
> --WjW
> 
> [  3%] Building CXX object
> src/CMakeFiles/common.dir/common/perf_counters.cc.o
> cd /home/wjw/ceph/build/src && /usr/bin/CC
> -DCEPH_LIBDIR=\"/usr/local/lib\"
> -DCEPH_PKGLIBDIR=\"/usr/local/lib/ceph\"
> -I/home/wjw/ceph/build/src/include -I/home/wjw/ceph/src
> -I/usr/local/include -I/home/wjw/ceph/build/include
> -I/home/wjw/ceph/src/xxHash  -Wall -Wtype-limits -Wignored-qualifiers
> -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing
> -fsigned-char -Wno-inconsistent-missing-override -Wno-mismatched-tags
> -Wno-unused-function -Wno-unused-local-typedef
> -Wno-inconsistent-missing-override -Wno-unused-private-field
> -Wno-varargs -Wno-gnu-designator -Wno-mismatched-tags
> -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register
> -ftemplate-depth-1024 -Wno-invalid-offsetof -Wnon-virtual-dtor
> -Wno-overloaded-virtual -fdiagnostics-color=auto
> -I/usr/local/include/nss/nss -I/usr/local/include/nspr
> -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc
> -fno-builtin-free -O0 -g -fPIC   -DHAVE_CONFIG_H -D__CEPH__ -D_REENTRANT
> -D_THREAD_SAFE -D__STDC_FORMAT_MACROS -std=c++11 -o
> CMakeFiles/common.dir/common/perf_counters.cc.o -c
> /home/wjw/ceph/src/common/perf_counters.cc
> In file included from /home/wjw/ceph/src/common/perf_counters.cc:17:
> In file included from /home/wjw/ceph/src/common/perf_counters.h:21:
> In file included from /home/wjw/ceph/src/include/utime.h:18:
> /usr/include/c++/v1/math.h:845:37: error: reference to 'log' is ambiguous
> log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);}
>^
> /usr/include/c++/v1/math.h:845:1: note: candidate found by name lookup
> is 'log'
> log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);}
> ^
> /usr/include/c++/v1/math.h:839:46: note: candidate found by name lookup
> is 'log'
> inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x)
> _NOEXCEPT {return logl(__lcpp_x);}
> ^
> /usr/include/c++/v1/math.h:838:46: note: candidate found by name lookup
> is 'log'
> inline _LIBCPP_INLINE_VISIBILITY float   log(float __lcpp_x)
> _NOEXCEPT   {return logf(__lcpp_x);}
> ^
> /usr/include/math.h:247:8: note: candidate found by name lookup is 'log'
> double  log(double);
>^
> /home/wjw/ceph/src/common/ceph_context.h:44:13: note: candidate found by
> name lookup is 'ceph::log'
>  namespace log {
>^


Okay, no -isystem options there.  So that's not it.  Now I'm assuming
this is because the original .cc file includes , which imports a
global "log" symbol.  Can you try changing that include to ?
However, this could require prefixing some math function calls with
std::.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail