OSDN Git Service

these defines are created for use in features.h so no point in duplicating work in...
[uclinux-h8/uClibc.git] / Rules.mak
1 # Rules.make for uClibc
2 #
3 # Copyright (C) 2000 by Lineo, inc.
4 # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
5 #
6 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7 #
8
9 #-----------------------------------------------------------
10 # This file contains rules which are shared between multiple
11 # Makefiles.  All normal configuration options live in the 
12 # file named ".config".  Don't mess with this file unless 
13 # you know what you are doing.
14
15
16 #-----------------------------------------------------------
17 # If you are running a cross compiler, you will want to set 
18 # 'CROSS' to something more interesting ...  Target 
19 # architecture is determined by asking the CC compiler what 
20 # arch it compiles things for, so unless your compiler is 
21 # broken, you should not need to specify TARGET_ARCH.
22 #
23 # Most people will set this stuff on the command line, i.e.
24 #        make CROSS=arm-linux-
25 # will build uClibc for 'arm'.
26
27 ifndef CROSS
28 CROSS=
29 endif
30 CC         = $(CROSS)gcc
31 AR         = $(CROSS)ar
32 LD         = $(CROSS)ld
33 NM         = $(CROSS)nm
34 STRIPTOOL  = $(CROSS)strip
35
36 INSTALL    = install
37 LN         = ln
38 RM         = rm -f
39 TAR        = tar
40
41 STRIP_FLAGS ?= -x -R .note -R .comment
42
43 # Select the compiler needed to build binaries for your development system
44 HOSTCC     = gcc
45 BUILD_CFLAGS = -O2 -Wall
46
47
48 #---------------------------------------------------------
49 # Nothing beyond this point should ever be touched by mere
50 # mortals.  Unless you hang out with the gods, you should
51 # probably leave all this stuff alone.
52
53 # Pull in the user's uClibc configuration
54 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
55 -include $(top_builddir).config
56 endif
57
58 # Make certain these contain a final "/", but no "//"s.
59 TARGET_ARCH:=$(shell grep -s '^TARGET_ARCH' $(top_builddir)/.config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
60 TARGET_ARCH:=$(strip $(subst ",, $(strip $(TARGET_ARCH))))
61 RUNTIME_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(RUNTIME_PREFIX))))))
62 DEVEL_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(DEVEL_PREFIX))))))
63 KERNEL_SOURCE:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(KERNEL_SOURCE))))))
64 export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_SOURCE
65
66
67 # Now config hard core
68 MAJOR_VERSION := 0
69 MINOR_VERSION := 9
70 SUBLEVEL      := 28
71 VERSION       := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
72 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
73 LC_ALL := C
74 export MAJOR_VERSION MINOR_VERSION SUBLEVEL VERSION LC_ALL
75
76 LIBC := libc
77 SHARED_MAJORNAME := $(LIBC).so.$(MAJOR_VERSION)
78 UCLIBC_LDSO_NAME := ld-uClibc
79 ifeq ($(TARGET_ARCH),x86_64)
80 UCLIBC_LDSO_NAME := ld64-uClibc
81 endif
82 UCLIBC_LDSO := $(UCLIBC_LDSO_NAME).so.$(MAJOR_VERSION)
83 NONSHARED_LIBNAME := uclibc_nonshared.a
84 libc := $(top_builddir)lib/$(SHARED_MAJORNAME)
85 interp := $(top_builddir)lib/interp.os
86 ldso := $(top_builddir)lib/$(UCLIBC_LDSO)
87 headers_dep := $(top_builddir)include/bits/sysnum.h
88 sub_headers := $(headers_dep)
89
90 #LIBS :=$(interp) -L$(top_builddir)lib -lc
91 LIBS := $(interp) -L$(top_builddir)lib $(libc:.$(MAJOR_VERSION)=)
92
93 # Make sure DESTDIR and PREFIX can be used to install
94 # PREFIX is a uClibcism while DESTDIR is a common GNUism
95 ifndef PREFIX
96 PREFIX = $(DESTDIR)
97 endif
98
99 ifneq ($(HAVE_SHARED),y)
100 libc :=
101 interp :=
102 ldso :=
103 endif
104
105 ifndef CROSS
106 CROSS=$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
107 endif
108
109 # A nifty macro to make testing gcc features easier
110 check_gcc=$(shell \
111         if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
112         then echo "$(1)"; else echo "$(2)"; fi)
113 check_as=$(shell \
114         if $(CC) -Wa,$(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; \
115         then echo "-Wa,$(1)"; fi)
116
117 ARFLAGS:=cr
118
119 OPTIMIZATION:=
120 PICFLAG:=-fPIC
121 PIEFLAG_NAME:=-fPIE
122
123 # Some nice CPU specific optimizations
124 ifeq ($(TARGET_ARCH),i386)
125         OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
126         OPTIMIZATION+=$(call check_gcc,-falign-jumps=0 -falign-loops=0,-malign-jumps=0 -malign-loops=0)
127         CPU_CFLAGS-$(CONFIG_386)+=-march=i386
128         CPU_CFLAGS-$(CONFIG_486)+=-march=i486
129         CPU_CFLAGS-$(CONFIG_ELAN)+=-march=i486
130         CPU_CFLAGS-$(CONFIG_586)+=-march=i586
131         CPU_CFLAGS-$(CONFIG_586MMX)+=$(call check_gcc,-march=pentium-mmx,-march=i586)
132         CPU_CFLAGS-$(CONFIG_686)+=-march=i686
133         CPU_CFLAGS-$(CONFIG_PENTIUMII)+=$(call check_gcc,-march=pentium2,-march=i686)
134         CPU_CFLAGS-$(CONFIG_PENTIUMIII)+=$(call check_gcc,-march=pentium3,-march=i686)
135         CPU_CFLAGS-$(CONFIG_PENTIUM4)+=$(call check_gcc,-march=pentium4,-march=i686)
136         CPU_CFLAGS-$(CONFIG_K6)+=$(call check_gcc,-march=k6,-march=i586)
137         CPU_CFLAGS-$(CONFIG_K7)+=$(call check_gcc,-march=athlon,-march=i686) $(call check_gcc,-falign-functions=4,-malign-functions=4)
138         CPU_CFLAGS-$(CONFIG_CRUSOE)+=-march=i686 $(call check_gcc,-falign-functions=0,-malign-functions=0)
139         CPU_CFLAGS-$(CONFIG_WINCHIPC6)+=$(call check_gcc,-march=winchip-c6,-march=i586)
140         CPU_CFLAGS-$(CONFIG_WINCHIP2)+=$(call check_gcc,-march=winchip2,-march=i586)
141         CPU_CFLAGS-$(CONFIG_CYRIXIII)+=$(call check_gcc,-march=c3,-march=i486) $(call check_gcc,-falign-functions=0,-malign-functions=0)
142         CPU_CFLAGS-$(CONFIG_NEHEMIAH)+=$(call check_gcc,-march=c3-2,-march=i686)
143 endif
144
145 ifeq ($(TARGET_ARCH),sparc)
146         CPU_CFLAGS-$(CONFIG_SPARC_V7)+=-mcpu=v7
147         CPU_CFLAGS-$(CONFIG_SPARC_V8)+=-mcpu=v8
148         CPU_CFLAGS-$(CONFIG_SPARC_V9)+=-mcpu=v9
149         CPU_CFLAGS-$(CONFIG_SPARC_V9B)+=$(call check_gcc,-mcpu=v9b,-mcpu=ultrasparc)
150 endif
151
152 ifeq ($(TARGET_ARCH),arm)
153         OPTIMIZATION+=-fstrict-aliasing
154         CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN)+=-EL
155         CPU_LDFLAGS-$(ARCH_BIG_ENDIAN)+=-EB
156         CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian
157         CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian
158         CPU_CFLAGS-$(CONFIG_GENERIC_ARM)+=
159         CPU_CFLAGS-$(CONFIG_ARM610)+=-mtune=arm610 -march=armv3
160         CPU_CFLAGS-$(CONFIG_ARM710)+=-mtune=arm710 -march=armv3
161         CPU_CFLAGS-$(CONFIG_ARM7TDMI)+=-mtune=arm7tdmi -march=armv4
162         CPU_CFLAGS-$(CONFIG_ARM720T)+=-mtune=arm7tdmi -march=armv4
163         CPU_CFLAGS-$(CONFIG_ARM920T)+=-mtune=arm9tdmi -march=armv4
164         CPU_CFLAGS-$(CONFIG_ARM922T)+=-mtune=arm9tdmi -march=armv4
165         CPU_CFLAGS-$(CONFIG_ARM926T)+=-mtune=arm9tdmi -march=armv5
166         CPU_CFLAGS-$(CONFIG_ARM1136JF_S)+=-mtune=arm1136jf-s -march=armv6
167         CPU_CFLAGS-$(CONFIG_ARM_SA110)+=-mtune=strongarm110 -march=armv4
168         CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4
169         CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110)
170         CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv4 -Wa,-mcpu=xscale
171 endif
172
173 ifeq ($(TARGET_ARCH),mips)
174         CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN)+=-EL
175         CPU_LDFLAGS-$(ARCH_BIG_ENDIAN)+=-EB
176         CPU_CFLAGS-$(CONFIG_MIPS_ISA_1)+=-mips1
177         CPU_CFLAGS-$(CONFIG_MIPS_ISA_2)+=-mips2 -mtune=mips2
178         CPU_CFLAGS-$(CONFIG_MIPS_ISA_3)+=-mips3 -mtune=mips3
179         CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4
180         CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32
181         CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32
182 endif
183
184 ifeq ($(TARGET_ARCH),nios)
185         CPU_LDFLAGS-y+=-m32
186         CPU_CFLAGS-y+=-m32
187 endif
188
189 ifeq ($(TARGET_ARCH),sh)
190         OPTIMIZATION+=-fstrict-aliasing
191         OPTIMIZATION+= $(call check_gcc,-mprefergot,)
192         CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN)+=-EL
193         CPU_LDFLAGS-$(ARCH_BIG_ENDIAN)+=-EB
194         CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-ml
195         CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mb
196         CPU_CFLAGS-$(CONFIG_SH2)+=-m2
197         CPU_CFLAGS-$(CONFIG_SH3)+=-m3
198 ifeq ($(UCLIBC_HAS_FLOATS),y)
199         CPU_CFLAGS-$(CONFIG_SH2A)+=-m2a
200         CPU_CFLAGS-$(CONFIG_SH4)+=-m4
201 else
202         CPU_CFLAGS-$(CONFIG_SH2A)+=-m2a-nofpu
203         CPU_CFLAGS-$(CONFIG_SH4)+=-m4-nofpu
204 endif
205 endif
206
207 ifeq ($(TARGET_ARCH),sh64)
208         OPTIMIZATION+=-fstrict-aliasing
209         CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN):=-EL
210         CPU_LDFLAGS-$(ARCH_BIG_ENDIAN):=-EB
211         CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN):=-ml
212         CPU_CFLAGS-$(ARCH_BIG_ENDIAN):=-mb
213         CPU_CFLAGS-$(CONFIG_SH5)+=-m5-32media
214 endif
215
216 ifeq ($(TARGET_ARCH),h8300)
217         CPU_LDFLAGS-$(CONFIG_H8300H)+= -ms8300h
218         CPU_LDFLAGS-$(CONFIG_H8S)   += -ms8300s
219         CPU_CFLAGS-$(CONFIG_H8300H) += -mh -mint32
220         CPU_CFLAGS-$(CONFIG_H8S)    += -ms -mint32
221 endif
222
223 ifeq ($(TARGET_ARCH),cris)
224         CPU_LDFLAGS-$(CONFIG_CRIS)+=-mcrislinux
225         CPU_CFLAGS-$(CONFIG_CRIS)+=-mlinux
226         PICFLAG:=-fpic
227         PIEFLAG_NAME:=-fpie
228 endif
229
230 ifeq ($(TARGET_ARCH),powerpc)
231 # PowerPC can hold 8192 entries in its GOT with -fpic which is more than
232 # enough. Therefore use -fpic which will reduce code size and generates
233 # faster code.
234         PICFLAG:=-fpic
235         PIEFLAG_NAME:=-fpie
236 endif
237
238 ifeq ($(TARGET_ARCH),bfin)
239         # This should also work, but why bother ? ;)
240         #PICFLAG:=-fPIC -mid-shared-library
241         PICFLAG:=-fpic
242 endif
243
244 ifeq ($(TARGET_ARCH),frv)
245         CPU_LDFLAGS-$(CONFIG_FRV)+=-melf32frvfd
246         CPU_CFLAGS-$(CONFIG_FRV)+=-mfdpic
247         # Using -pie causes the program to have an interpreter, which is
248         # forbidden, so we must make do with -shared.  Unfortunately,
249         # -shared by itself would get us global function descriptors
250         # and calls through PLTs, dynamic resolution of symbols, etc,
251         # which would break as well, but -Bsymbolic comes to the rescue.
252         export LDPIEFLAG:=-shared -Bsymbolic
253         UCLIBC_LDSO=ld.so.1
254 endif
255
256 # Keep the check_gcc from being needlessly executed
257 ifndef PIEFLAG
258 ifneq ($(UCLIBC_BUILD_PIE),y)
259 export PIEFLAG:=
260 else
261 export PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),$(PICFLAG))
262 endif
263 endif
264 # We need to keep track of both the CC PIE flag (above) as 
265 # well as the LD PIE flag (below) because we can't rely on 
266 # gcc passing -pie if we used -fPIE
267 ifndef LDPIEFLAG
268 ifneq ($(UCLIBC_BUILD_PIE),y)
269 export LDPIEFLAG:=
270 else
271 export LDPIEFLAG:=$(shell $(LD) --help | grep -q pie && echo "-Wl,-pie")
272 endif
273 endif
274
275 # Check for AS_NEEDED support in linker script (binutils>=2.16.1 has it)
276 ifndef ASNEEDED
277 ifneq ($(UCLIBC_HAS_SSP),y)
278 export ASNEEDED:=
279 else
280 export ASNEEDED:=$(shell (LD_TMP=$(mktemp LD_XXXXXX) ; echo "GROUP ( AS_NEEDED ( /usr/lib/libc.so ) )" > $LD_TMP && if $(LD) -T $LD_TMP -o /dev/null > /dev/null 2>&1; then echo "AS_NEEDED ( $(UCLIBC_LDSO) )"; else echo "$(UCLIBC_LDSO)"; fi; rm -f $LD_TMP ) )
281 endif
282 endif
283
284 # Use '-Os' optimization if available, else use -O2, allow Config to override
285 OPTIMIZATION+=$(call check_gcc,-Os,-O2)
286 # Use the gcc 3.4 -funit-at-a-time optimization when available
287 OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
288
289 # Add a bunch of extra pedantic annoyingly strict checks
290 XWARNINGS=$(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
291 ifeq ($(EXTRA_WARNINGS),y)
292 XWARNINGS+=-Wnested-externs -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wformat=2
293 XWARNINGS+=-Wmissing-prototypes -Wmissing-declarations
294 # works only w/ gcc-3.4 and up, can't be checked for gcc-3.x w/ check_gcc()
295 #XWARNINGS+=-Wdeclaration-after-statement
296 endif
297 XARCH_CFLAGS=$(subst ",, $(strip $(ARCH_CFLAGS)))
298 CPU_CFLAGS=$(subst ",, $(strip $(CPU_CFLAGS-y)))
299
300 SSP_DISABLE_FLAGS ?= $(call check_gcc,-fno-stack-protector,)
301 ifeq ($(UCLIBC_BUILD_SSP),y)
302 SSP_CFLAGS := $(call check_gcc,-fno-stack-protector-all,)
303 SSP_CFLAGS += $(call check_gcc,-fstack-protector,)
304 SSP_ALL_CFLAGS ?= $(call check_gcc,-fstack-protector-all,)
305 else
306 SSP_CFLAGS := $(SSP_DISABLE_FLAGS)
307 endif
308
309 # Some nice CFLAGS to work with
310 CFLAGS := -include $(top_builddir)include/libc-symbols.h \
311         $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \
312         -fno-builtin -nostdinc -I$(top_builddir)include -I.
313
314 LDADD_LIBFLOAT=
315 ifeq ($(UCLIBC_HAS_SOFT_FLOAT),y)
316 # If -msoft-float isn't supported, we want an error anyway.
317 # Hmm... might need to revisit this for arm since it has 2 different
318 # soft float encodings.
319 ifneq ($(TARGET_ARCH),nios)
320 ifneq ($(TARGET_ARCH),nios2)
321 CFLAGS += -msoft-float
322 endif
323 endif
324 ifeq ($(TARGET_ARCH),arm)
325 # No longer needed with current toolchains, but leave it here for now.
326 # If anyone is actually still using gcc 2.95 (say), they can uncomment it.
327 #    LDADD_LIBFLOAT=-lfloat
328 endif
329 endif
330
331 # Make sure "char" behavior is the same everywhere
332 CFLAGS += -fsigned-char
333
334 # We need this to be checked within libc-symbols.h
335 ifneq ($(HAVE_SHARED),y)
336 CFLAGS += -DSTATIC
337 endif
338
339 # only i386 is known to work if compile.S gets -D__ASSEMBLER__
340 #CFLAGS += $(call check_gcc,-std=c99,)
341
342 LDFLAGS_NOSTRIP:=$(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc
343
344 ifeq ($(UCLIBC_BUILD_RELRO),y)
345 LDFLAGS_NOSTRIP+=-z relro
346 endif
347
348 ifeq ($(UCLIBC_BUILD_NOW),y)
349 LDFLAGS_NOSTRIP+=-z now
350 endif
351
352 LDFLAGS:=$(LDFLAGS_NOSTRIP) -z defs
353 ifeq ($(DODEBUG),y)
354     #CFLAGS += -g3
355     CFLAGS += -O0 -g3
356     STRIPTOOL:= true -Since_we_are_debugging
357 else
358     CFLAGS += $(OPTIMIZATION) $(XARCH_CFLAGS)
359     LDFLAGS += -s
360 endif
361
362 ifeq ($(DOMULTI),y)
363 # we try to compile all sources at once into an object (IMA), but
364 # gcc-3.3.x does not support it
365 # gcc-3.4.x supports it, but does not need and support --combine. though fails on many sources
366 # gcc-4.0.x supports it, supports the --combine flag, but does not need it
367 # gcc-4.1(200506xx) supports it, but needs the --combine flag, else libs are useless
368 GCC_VER?=$(shell $(CC) -dumpversion | cut -d . -f 1)
369 ifeq ($(GCC_VER),3)
370 DOMULTI:=n
371 else
372 CFLAGS+=$(call check_gcc,--combine,)
373 endif
374 else
375 DOMULTI:=n
376 endif
377
378 ifeq ($(UCLIBC_HAS_THREADS),y)
379 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
380         PTNAME := nptl
381 else
382 ifeq ($(LINUXTHREADS_OLD),y)
383         PTNAME := linuxthreads.old
384 else
385         PTNAME := linuxthreads
386 endif
387 endif
388 PTDIR := $(top_builddir)libpthread/$(PTNAME)
389 # set up system dependencies include dirs (NOTE: order matters!)
390 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
391 PTINC:= -I$(PTDIR)                                              \
392         -I$(PTDIR)/compat                                       \
393         -I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)       \
394         -I$(PTDIR)/sysdeps/$(TARGET_ARCH)                       \
395         -I$(PTDIR)/sysdeps/unix/sysv/linux                      \
396         -I$(PTDIR)/sysdeps/pthread                              \
397         -I$(PTDIR)/sysdeps/pthread/bits                         \
398         -I$(PTDIR)/sysdeps/generic                              \
399         -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH)                 \
400         -I$(top_srcdir)ldso/include                             \
401         -include $(PTDIR)/compat/libc-symbols.h
402 #
403 # Test for TLS if NPTL support was selected.
404 #
405 GCC_HAS_TLS=$(shell \
406         echo "extern __thread int foo;" | $(CC) -o /dev/null -S -xc - 2>&1)
407 ifneq ($(GCC_HAS_TLS),)
408 gcc_tls_test_fail:
409         @echo "####";
410         @echo "#### Your compiler does not support TLS and you are trying to build uClibc";
411         @echo "#### with NPTL support. Upgrade your binutils and gcc to versions which";
412         @echo "#### support TLS for your architecture. Do not contact uClibc maintainers";
413         @echo "#### about this problem.";
414         @echo "####";
415         @echo "#### Exiting...";
416         @echo "####";
417         @exit 1;
418 endif
419 else
420 PTINC := \
421         -I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
422         -I$(PTDIR)/sysdeps/$(TARGET_ARCH) \
423         -I$(PTDIR)/sysdeps/unix/sysv/linux \
424         -I$(PTDIR)/sysdeps/pthread \
425         -I$(PTDIR) \
426         -I$(top_builddir)libpthread
427 endif
428 CFLAGS+=$(PTINC)
429 else
430         PTNAME := 
431         PTINC  := 
432 endif
433
434 # Sigh, some stupid versions of gcc can't seem to cope with '-iwithprefix include'
435 #CFLAGS+=-iwithprefix include
436 CFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
437
438 ifneq ($(DOASSERTS),y)
439 CFLAGS+=-DNDEBUG
440 endif
441
442 # moved from ldso/{ldso,libdl}
443 # BEWARE!!! At least mips* will die if -O0 is used!!!
444 ifeq ($(TARGET_ARCH),mips)
445 CFLAGS:=$(CFLAGS:-O0=-O1)
446 endif
447
448 # Keep the check_as from being needlessly executed
449 ifndef ASFLAGS_NOEXEC
450 ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
451 export ASFLAGS_NOEXEC := $(call check_as,--noexecstack)
452 else
453 export ASFLAGS_NOEXEC :=
454 endif
455 endif
456 ASFLAGS = $(ASFLAGS_NOEXEC)
457
458 LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
459 LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
460 LIBGCC_DIR:=$(dir $(LIBGCC))
461
462 # moved from libpthread/linuxthreads
463 ifeq ($(UCLIBC_CTOR_DTOR),y)
464 SHARED_START_FILES:=$(top_builddir)lib/crti.o $(LIBGCC_DIR)crtbeginS.o
465 SHARED_END_FILES:=$(LIBGCC_DIR)crtendS.o $(top_builddir)lib/crtn.o
466 endif
467
468 ########################################
469 #
470 # uClinux shared lib support
471 #
472
473 ifeq ($(CONFIG_BINFMT_SHARED_FLAT),y)
474   # For the shared version of this, we specify no stack and its library ID
475   FLTFLAGS += -s 0
476   LIBID=1
477   export LIBID FLTFLAGS
478   SHARED_TARGET = lib/libc
479 endif