summaryrefslogtreecommitdiffstats
path: root/external/nss/nss.patch
blob: 5483635787893038c0d61ed5a2defd094bfad6a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
--- a/nss.orig/nspr/pr/src/misc/prnetdb.c	2016-02-12 14:51:25.000000000 +0100
+++ b/nss/nspr/pr/src/misc/prnetdb.c	2016-03-04 19:23:00.462892600 +0100
@@ -438,7 +438,7 @@
 	char *buf = *bufp;
 	PRIntn buflen = *buflenp;
 
-	if (align && ((long)buf & (align - 1))) {
+	if (align && ((ptrdiff_t)buf & (align - 1))) {
 		PRIntn skip = align - ((ptrdiff_t)buf & (align - 1));
 		if (buflen < skip) {
 			return 0;
diff -ru a/nspr/configure b/nspr/configure
--- a/a/nspr/configure	2014-09-29 16:46:38.427423757 +0100
+++ b/b/nspr/configure	2014-09-29 16:47:42.984012225 +0100
@@ -7018,7 +7018,7 @@
     PR_MD_CSRCS=linux.c
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     DSO_CFLAGS=-fPIC
-    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
+    DSO_LDOPTS='-shared -Wl,-z,origin -Wl,-rpath,\$$ORIGIN -Wl,-soname -Wl,$(notdir $@)'
     _OPTIMIZE_FLAGS=-O2
     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
                                    # combo is not yet good at debugging inlined
diff -ru a/nss/cmd/platlibs.mk b/nss/cmd/platlibs.mk
--- a/a/nss/cmd/platlibs.mk	2014-09-29 16:46:38.306422654 +0100
+++ b/b/nss/cmd/platlibs.mk	2014-09-29 16:47:42.987012253 +0100
@@ -10,17 +10,22 @@
 
 ifeq ($(OS_ARCH), SunOS) 
 ifeq ($(USE_64), 1)
-EXTRA_SHARED_LIBS += -R '$$ORIGIN/../lib:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
+#In OOo we would probable put the executables next to libs
+EXTRA_SHARED_LIBS += -R '$$ORIGIN'
 else
-EXTRA_SHARED_LIBS += -R '$$ORIGIN/../lib:/usr/lib/mps/secv1:/usr/lib/mps'
+EXTRA_SHARED_LIBS += -R '$$ORIGIN'
 endif
 endif
 
+ifeq ($(OS_ARCH), FreeBSD)
+EXTRA_SHARED_LIBS += -Wl,-z,origin -Wl,-rpath,'$$ORIGIN'
+endif
+
 ifeq ($(OS_ARCH), Linux)
 ifeq ($(USE_64), 1)
-EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN/../lib64:/opt/sun/private/lib64:$$ORIGIN/../lib'
+EXTRA_SHARED_LIBS += -Wl,-z,origin -Wl,-rpath,'$$ORIGIN'
 else
-EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN/../lib:/opt/sun/private/lib'
+EXTRA_SHARED_LIBS += -Wl,-z,origin -Wl,-rpath,'$$ORIGIN'
 endif
 endif
 
diff -ru nss.orig/nss/coreconf/arch.mk nss/nss/coreconf/arch.mk
--- a/nss.orig/nss/coreconf/arch.mk	2016-02-12 15:36:18.000000000 +0100
+++ b/nss/nss/coreconf/arch.mk	2016-02-23 20:48:31.595941079 +0100
@@ -280,15 +280,21 @@
 # IMPL_STRATEGY may be defined too.
 #
 
-ifdef CROSS_COMPILE
-OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
-else
-OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
-endif
+# OBJDIR_NAME is used to build the directory containing the built objects, for 
+# example mozilla/dist/Linux2.6_x86_glibc_PTH_DBG.OBJ
+# We need to deliver the contents of that folder into instdir. To make that 
+# easier in the makefile we rename this directory to "out". 
+#ifdef CROSS_COMPILE
+#OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
+#else
+#OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
+#endif
+OBJDIR_NAME = out
 
 
 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
-ifndef BUILD_OPT
+ifdef THIS_HAS_BEEN_DISABLED_TO_GET_out
+
 #
 # Define USE_DEBUG_RTL if you want to use the debug runtime library
 # (RTL) in the debug build
diff -ru a/nss/coreconf/FreeBSD.mk b/nss/coreconf/FreeBSD.mk
--- a/a/nss/coreconf/FreeBSD.mk	2014-09-29 16:46:38.189421588 +0100
+++ b/b/nss/coreconf/FreeBSD.mk	2014-09-29 16:47:42.984012225 +0100
@@ -25,6 +25,7 @@
 
 DSO_CFLAGS		= -fPIC
 DSO_LDOPTS		= -shared -Wl,-soname -Wl,$(notdir $@)
+DSO_LDOPTS		+= -Wl,-z,origin '-Wl,-rpath,$$ORIGIN'
 
 #
 # The default implementation strategy for FreeBSD is pthreads.
diff -ru a/nss/coreconf/Linux.mk b/nss/coreconf/Linux.mk
--- a/a/nss/coreconf/Linux.mk	2014-09-29 16:46:38.189421588 +0100
+++ b/b/nss/coreconf/Linux.mk	2014-09-29 16:47:42.985012235 +0100
@@ -16,8 +16,11 @@
 	IMPL_STRATEGY = _PTH
 endif
 
-CC			= gcc
-CCC			= g++
+# CC is taken from environment automatically.
+#CC			= gcc
+# Use CCC from environment.
+#CCC			= g++
+CCC		= $(CXX)
 RANLIB			= ranlib
 
 DEFAULT_COMPILER = gcc
@@ -145,7 +148,7 @@
 # incorrectly reports undefined references in the libraries we link with, so
 # we don't use -z defs there.
 ZDEFS_FLAG		= -Wl,-z,defs
-DSO_LDOPTS		+= $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG))
+DSO_LDOPTS		+= $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) -Wl,-z,origin '-Wl,-rpath,$$ORIGIN'
 LDFLAGS			+= $(ARCHFLAG)
 
 # On Maemo, we need to use the -rpath-link flag for even the standard system
@@ -176,8 +179,13 @@
 endif
 endif
 
+ifneq ($(SYSTEM_ZLIB),)
+# Currently (3.12.4) only the tools modutil and signtool are linked with libz
+# If USE_SYSTEM_ZLIB is not set then the tools link statically libzlib.a which
+# is also built in nss.
 USE_SYSTEM_ZLIB = 1
 ZLIB_LIBS = -lz
+endif
 
 # The -rpath '$$ORIGIN' linker option instructs this library to search for its
 # dependencies in the same directory where it resides.
diff -ru a/nss/coreconf/rules.mk b/nss/coreconf/rules.mk
--- a/a/nss/coreconf/rules.mk	2014-09-29 16:46:38.188421578 +0100
+++ b/b/nss/coreconf/rules.mk	2014-09-29 16:47:42.986012244 +0100
@@ -261,7 +261,7 @@
 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
 	$(AR) $(subst /,\\,$(OBJS))
 else
-	$(AR) $(OBJS)
+	$(AR) cr $@ $(OBJS)
 endif
 	$(RANLIB) $@
 
diff -ru a/nss/coreconf/SunOS5.mk b/nss/coreconf/SunOS5.mk
--- a/a/nss/coreconf/SunOS5.mk	2014-09-29 16:46:38.175421471 +0100
+++ b/b/nss/coreconf/SunOS5.mk	2014-09-29 16:47:42.985012235 +0100
@@ -48,8 +48,12 @@
 	    # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer
 	endif
 else
-	CC         = cc
-	CCC        = CC
+# CC is taken from environment automatically.
+#	CC         = cc
+# Use CXX from environment.
+#	CCC        = CC
+        CCC       = $(CXX)
+
 	ASFLAGS   += -Wa,-P
 	OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
 	ifndef BUILD_OPT
diff -ru a/nss/Makefile b/nss/Makefile
--- a/a/nss/Makefile	2014-09-29 16:46:38.171421425 +0100
+++ b/b/nss/Makefile	2014-09-29 16:47:42.987012253 +0100
@@ -1,3 +1,5 @@
+export AR
+export RANLIB
 #! gmake
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
diff -ru nss.orig/nss/coreconf/Werror.mk nss/nss/coreconf/Werror.mk
--- a/nss.orig/nss/coreconf/Werror.mk	2016-02-12 15:36:18.000000000 +0100
+++ b/nss/nss/coreconf/Werror.mk	2016-02-23 23:58:15.119584046 +0100
@@ -60,7 +60,8 @@
   endif #ndef NSS_ENABLE_WERROR
 
   ifeq ($(NSS_ENABLE_WERROR),1)
-    WARNING_CFLAGS += -Werror
+# We do not treat warnings as errors.
+#    WARNING_CFLAGS += -Werror
   else
     # Old versions of gcc (< 4.8) don't support #pragma diagnostic in functions.
     # Use this to disable use of that #pragma and the warnings it suppresses.