]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - Makerules
Regenerate libc.pot
[thirdparty/glibc.git] / Makerules
index 8db0ca129650a9ca0612cb63273f48ecedfad7fe..018780c818cab0d4626e31308f013582114fca4f 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2021 Free Software Foundation, Inc.
+# Copyright (C) 1991-2023 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -200,7 +200,7 @@ endif
 ifndef subdir
 # If a makefile needs to do something conditional on something that
 # can only be figured out from headers, write a FOO.make.c input
-# file that uses cpp contructs and contains @@@ LINE @@@ for each LINE
+# file that uses cpp constructs and contains @@@ LINE @@@ for each LINE
 # to emit in the generated makefile, and use -include $(common-objpfx)FOO.make.
 #
 # We only generate these in the top-level makefile, to avoid any weirdness
@@ -424,6 +424,12 @@ $(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)
 endef
 object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
+
+define o-iterator-doit
+$(objpfx)%$o: $(objpfx)%.cc $(before-compile); $$(compile-command.cc)
+endef
+object-suffixes-left := $(all-object-suffixes)
+include $(o-iterator)
 endif
 
 # Generate .dT files as we compile.
@@ -530,6 +536,7 @@ lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(link-libc-deps)
 define build-shlib-helper
 $(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \
          $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(rtld-LDFLAGS) \
+         $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(dt-relr-ldflag)) \
          $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
          $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
          -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
@@ -537,60 +544,18 @@ $(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \
          -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
 endef
 
-ifeq (yes,$(use-default-link))
-# If the linker is good enough, we can let it use its default linker script.
-shlib-lds =
-shlib-lds-flags =
-else
-# binutils only position loadable notes into the first page for binaries,
-# not for shared objects
-$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
-       $(LINK.o) -shared -Wl,-O1 \
-                 -nostdlib -nostartfiles \
-                 $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
-                 -Wl,--verbose 2>/dev/null | \
-         sed > $@T \
-             -e '/^=========/,/^=========/!d;/^=========/d' \
-             $(if $(filter yes,$(have-hash-style)), \
-                  -e 's/^.*\.gnu\.hash[        ]*:.*$$/  .note.ABI-tag : { *(.note.ABI-tag) } &/' \
-                  -e '/^[      ]*\.hash[       ]*:.*$$/{h;d;}' \
-                  -e '/DATA_SEGMENT_ALIGN/{H;g}' \
-               , \
-                  -e 's/^.*\.hash[     ]*:.*$$/  .note.ABI-tag : { *(.note.ABI-tag) } &/' \
-              ) \
-             -e 's/^.*\*(\.dynbss).*$$/& \
-                PROVIDE(__start___libc_freeres_ptrs = .); \
-                *(__libc_freeres_ptrs) \
-                PROVIDE(__stop___libc_freeres_ptrs = .);/'\
-             -e 's@^.*\*(\.jcr).*$$@& \
-                PROVIDE(__start___libc_subfreeres = .);\
-                __libc_subfreeres : { *(__libc_subfreeres) }\
-                PROVIDE(__stop___libc_subfreeres = .);\
-                PROVIDE(__start___libc_atexit = .);\
-                __libc_atexit : { *(__libc_atexit) }\
-                PROVIDE(__stop___libc_atexit = .);\
-                PROVIDE(__start___libc_IO_vtables = .);\
-                __libc_IO_vtables : { *(__libc_IO_vtables) }\
-                PROVIDE(__stop___libc_IO_vtables = .);\
-                /DISCARD/ : { *(.gnu.glibc-stub.*) }@'
-       test -s $@T
-       mv -f $@T $@
-common-generated += shlib.lds
-
-shlib-lds = $(common-objpfx)shlib.lds
-shlib-lds-flags = -T $(shlib-lds)
-endif
-
 define build-shlib
-$(build-shlib-helper) -o $@ $(shlib-lds-flags) \
+$(build-shlib-helper) -o $@ \
          $(csu-objpfx)abi-note.o $(build-shlib-objlist)
 endef
 
 define build-module-helper
 $(LINK.o) -shared -static-libgcc $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
          $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) \
+         $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(dt-relr-ldflag)) \
          -B$(csu-objpfx) $(load-map-file) \
          $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
+         $(link-test-modules-rpath-link) \
          -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
 endef
 
@@ -599,12 +564,12 @@ endef
 # binutils only position loadable notes into the first page for binaries,
 # not for shared objects
 define build-module
-$(build-module-helper) -o $@ $(shlib-lds-flags) \
+$(build-module-helper) -o $@ \
          $(csu-objpfx)abi-note.o $(build-module-objlist) $(link-libc-args)
 $(call after-link,$@)
 endef
 define build-module-asneeded
-$(build-module-helper) -o $@ $(shlib-lds-flags) \
+$(build-module-helper) -o $@ \
          $(csu-objpfx)abi-note.o \
          -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed \
          $(link-libc-args)
@@ -631,16 +596,11 @@ LDFLAGS-c.so = -nostdlib -nostartfiles
 LDLIBS-c.so += $(libc.so-gnulib)
 # Give libc.so an entry point and make it directly runnable itself.
 LDFLAGS-c.so += -e __libc_main
-# Pre-link the objects of libc_pic.a so that we can locally resolve
-# COMMON symbols before we link against ld.so.  This is because ld.so
-# contains some of libc_pic.a already, which will prevent the COMMONs
-# from being allocated in libc.so, which introduces evil dependencies
-# between libc.so and ld.so, which can make it impossible to upgrade.
+# Pre-link the objects of libc_pic.a for .gnu.glibc-stub.* processing.
 $(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
        $(LINK.o) -nostdlib -nostartfiles -r -o $@ \
-       $(LDFLAGS-c_pic.os) -Wl,-d $(whole-archive) $^ -o $@
+       $(LDFLAGS-c_pic.os) $(whole-archive) $^ -o $@
 
-ifeq (,$(strip $(shlib-lds-flags)))
 # Generate a list of -R options to excise .gnu.glibc-stub.* sections.
 $(common-objpfx)libc_pic.opts: $(common-objpfx)libc_pic.os
        $(OBJDUMP) -h $< | \
@@ -654,7 +614,6 @@ $(common-objpfx)libc_pic.os.clean: $(common-objpfx)libc_pic.opts \
 generated += libc_pic.opts libc_pic.os.clean
 
 libc_pic_clean := .clean
-endif
 
 # Build a possibly-modified version of libc_pic.a for use in building
 # linkobj/libc.so.
@@ -684,16 +643,14 @@ $(common-objpfx)linkobj/libc.so: link-libc-deps = # empty
 $(common-objpfx)libc.so: $(common-objpfx)libc_pic.os$(libc_pic_clean) \
                         $(elf-objpfx)sofini.os \
                         $(elf-objpfx)interp.os \
-                        $(elf-objpfx)ld.so \
-                        $(shlib-lds)
+                        $(elf-objpfx)ld.so
        $(build-shlib)
        $(call after-link,$@)
 
 $(common-objpfx)linkobj/libc.so: $(common-objpfx)linkobj/libc_pic.a \
                         $(elf-objpfx)sofini.os \
                         $(elf-objpfx)interp.os \
-                        $(elf-objpfx)ld.so \
-                        $(shlib-lds)
+                        $(elf-objpfx)ld.so
        $(build-shlib)
        $(call after-link,$@)
 
@@ -754,7 +711,7 @@ endif
 
 extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names))
 $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \
-               $(objpfx)%.os $(shlib-lds) $(link-libs-deps)
+               $(objpfx)%.os $(link-libs-deps)
        $(build-module)
 endif
 \f
@@ -763,6 +720,7 @@ endif
             $(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \
             $(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
             $(addsuffix .d,$(tests) $(tests-internal) $(xtests) \
+               $(tests-container) $(tests-printers) \
                $(test-srcs) $(tests-time64) $(xtests-time64))
 ifeq ($(build-programs),yes)
 +depfiles += $(addsuffix .d,$(others) $(sysdep-others))
@@ -795,7 +753,7 @@ endif
 # Maximize efficiency by minimizing the number of rules.
 .SUFFIXES:     # Clear the suffix list.  We don't use suffix rules.
 # Don't define any builtin rules.
-MAKEFLAGS := $(MAKEFLAGS)r
+MAKEFLAGS := $(MAKEFLAGS) -r
 
 # Generic rule for making directories.
 %/:
@@ -812,7 +770,7 @@ MAKEFLAGS := $(MAKEFLAGS)r
 .PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
 \f
 # Use the verbose option of ar and tar when not running silently.
-ifeq   "$(findstring s,$(MAKEFLAGS))" ""       # if not -s
+ifeq ($(silent-make),no)                       # if not -s
 verbose := v
 else                                           # -s
 verbose        :=
@@ -1251,14 +1209,22 @@ lib := testsuite
 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
 endif
 
-all-nonlib := $(strip $(tests-internal) $(test-internal-extras) \
-                     $(others) $(others-extras))
+all-nonlib := $(strip $(others) $(others-extras))
 ifneq (,$(all-nonlib))
 cpp-srcs-left = $(all-nonlib)
 lib := nonlib
 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
 endif
 
+# All internal tests use testsuite-internal module since for 64 bit time
+# support is set as default for MODULE_NAME=nonlib (which include some
+# installed programs).
+all-testsuite-internal := $(strip $(tests-internal) $(test-internal-extras))
+ifneq (,$(all-testsuite-internal))
+cpp-srcs-left = $(all-testsuite-internal)
+lib := testsuite-internal
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
+endif
 
 ifeq ($(build-shared),yes)
 # Generate normalized lists of symbols, versions, and data sizes.
@@ -1352,46 +1318,6 @@ endif
 
 endif
 \f
-# These will have been set by sysdeps/posix/Makefile.
-L_tmpnam  ?= 1
-TMP_MAX   ?= 0
-L_ctermid ?= 1
-L_cuserid ?= 1
-
-stdio_lim = $(common-objpfx)bits/stdio_lim.h
-
-$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @:
-$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
-                  $(common-objpfx)config.make
-       $(make-target-directory)
-       { echo '#include "$(..)posix/bits/posix1_lim.h"';               \
-       } |                                                             \
-       $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)'   \
-             $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT)
-       sed $(sed-remove-objpfx) $(sed-remove-dotdot)                   \
-           $(@:st=dT) > $(@:st=dt)
-       mv -f $(@:st=dt) $(@:st=d)
-       fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`;       \
-       filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`;    \
-       fopen_max=$${fopen_max:-16};                                    \
-       filename_max=$${filename_max:-1024};                            \
-       sed -e "s/@FOPEN_MAX@/$$fopen_max/"                             \
-           -e "s/@FILENAME_MAX@/$$filename_max/"                       \
-           -e "s/@L_tmpnam@/$(L_tmpnam)/"                              \
-           -e "s/@TMP_MAX@/$(TMP_MAX)/"                                \
-           -e "s/@L_ctermid@/$(L_ctermid)/"                            \
-           -e "s/@L_cuserid@/$(L_cuserid)/"                            \
-           $< > $(@:st=h.new)
-       $(move-if-change) $(@:st=h.new) $(@:st=h)
-# Remove these last so that they can be examined if something went wrong.
-       rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt)
-       touch $@
-# Get dependencies.
-ifndef no_deps
--include $(stdio_lim:h=d)
-endif
-common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st
-\f
 FORCE:
 
 .PHONY: echo-headers
@@ -1408,18 +1334,13 @@ echo-headers:
 clean: common-clean
 mostlyclean: common-mostlyclean
 
+# Remove test artifacts from a given directory
 do-tests-clean:
-       -rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) \
-                                                     $(tests-internal) \
-                                                     $(xtests) \
-                                                     $(test-srcs)) \
-                                    $(addsuffix .test-result,$(tests) \
-                                                             $(tests-internal) \
-                                                             $(xtests) \
-                                                             $(test-srcs)))
+       -find $(objpfx) -name '*.out' -delete
+       -find $(objpfx) -name '*.test-result' -delete
 
 # Remove the object files.
-common-mostlyclean:
+common-mostlyclean: do-tests-clean
        -rm -f $(addprefix $(objpfx),$(tests) $(tests-internal) $(xtests) \
                                     $(test-srcs) \
                                     $(others) $(sysdep-others) stubs \
@@ -1428,15 +1349,7 @@ common-mostlyclean:
                                                    $(xtests) \
                                                    $(test-srcs) \
                                                    $(others) \
-                                                   $(sysdep-others)) \
-                                    $(addsuffix .out,$(tests) \
-                                                     $(tests-internal) \
-                                                     $(xtests) \
-                                                     $(test-srcs)) \
-                                    $(addsuffix .test-result,$(tests) \
-                                                             $(tests-internal) \
-                                                             $(xtests) \
-                                                             $(test-srcs)))
+                                                   $(sysdep-others)))
        -rm -f $(addprefix $(objpfx),$(extra-objs) $(extra-test-objs) \
                                     $(install-lib) $(install-lib.so) \
                                     $(install-lib.so:%.so=%_pic.a))