From a3f7633492116879dd46a5b65ae7599c56f7eea7 Mon Sep 17 00:00:00 2001 From: marcel Date: Sun, 11 Dec 2016 03:57:21 +0000 Subject: MFC r305855, r306297, r306300, r306312-r306313 When MAKEOBJDIRPREFIX points to a case-insensitive file system, the build can break when different source files create the same object files (case-insensitivity speaking). This is the case for object files compiled with -fpic and shared libraries. The former uses an extension of ".So", and the latter an extension ".so". Rename shared object files from *.So to *.pico to match what NetBSD does. Also: o Compile _Exit.c as C99_Exit.c, as it conflicts with _exit.s o Add entry to UPDATING o Document .pico extension --- UPDATING | 6 ++++++ contrib/ofed/usr.lib/libsdp/Makefile | 2 +- gnu/lib/libgcc/Makefile | 14 +++++++------- gnu/lib/libgcov/Makefile | 2 +- lib/libc/stdlib/Makefile.inc | 9 ++++++++- lib/libedit/Makefile | 2 +- lib/libprocstat/Makefile | 6 +++--- lib/libthr/support/Makefile.inc | 6 +++--- share/mk/bsd.README | 2 +- share/mk/bsd.dep.mk | 4 ++-- share/mk/bsd.lib.mk | 20 ++++++++++---------- share/mk/meta.autodep.mk | 6 +++--- sys/conf/kern.post.mk | 6 +++--- sys/conf/kern.pre.mk | 2 +- usr.sbin/bsnmpd/modules/snmp_hostres/Makefile | 2 +- 15 files changed, 51 insertions(+), 38 deletions(-) diff --git a/UPDATING b/UPDATING index dab6226..33c15bd 100644 --- a/UPDATING +++ b/UPDATING @@ -16,6 +16,12 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20161210: + Relocatable object files with the extension of .So have been renamed + to use an extension of .pico instead. The purpose of this change is + to avoid a name clash with shared libraries on case-insensitive file + systems. On those file systems, foo.So is the same file as foo.so. + 20160622: The libc stub for the pipe(2) system call has been replaced with a wrapper that calls the pipe2(2) system call and the pipe(2) diff --git a/contrib/ofed/usr.lib/libsdp/Makefile b/contrib/ofed/usr.lib/libsdp/Makefile index cf7b2e3..54d09ca 100644 --- a/contrib/ofed/usr.lib/libsdp/Makefile +++ b/contrib/ofed/usr.lib/libsdp/Makefile @@ -22,4 +22,4 @@ CFLAGS+= -I${OFEDSYS}/include # Remove .[ly] since the checked-in version is preferred. .SUFFIXES: -.SUFFIXES: .o .po .So .c .ln +.SUFFIXES: .o .po .pico .c .ln diff --git a/gnu/lib/libgcc/Makefile b/gnu/lib/libgcc/Makefile index a6d14f9..64baf1b 100644 --- a/gnu/lib/libgcc/Makefile +++ b/gnu/lib/libgcc/Makefile @@ -254,8 +254,8 @@ OBJ_GRPS += FPBIT DPBIT .for T in ${OBJ_GRPS} ${T}_OBJS_T = ${${T}_FUNCS:S/$/.o/} ${T}_OBJS_P = ${${T}_FUNCS:S/$/.po/} -${T}_OBJS_S = ${${T}_FUNCS:S/$/.So/} -SOBJS += ${${T}_FUNCS:S/$/.So/} +${T}_OBJS_S = ${${T}_FUNCS:S/$/.pico/} +SOBJS += ${${T}_FUNCS:S/$/.pico/} ${${T}_OBJS_T}: ${${T}_CFILE} ${COMMONHDRS} ${CC_T} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} @@ -270,7 +270,7 @@ ${${T}_OBJS_S}: ${${T}_CFILE} ${COMMONHDRS} # Extra objects coming from separate files # .if !empty(LIB2ADD) -SOBJS += ${LIB2ADD:R:S/$/.So/} +SOBJS += ${LIB2ADD:R:S/$/.pico/} .endif #----------------------------------------------------------------------- @@ -294,9 +294,9 @@ ${STAT_OBJS_P}: ${STD_CFILE} ${COMMONHDRS} .if defined(LIB1ASMSRC) ASM_T = ${LIB1ASMFUNCS:S/$/.o/} ASM_P = ${LIB1ASMFUNCS:S/$/.po/} -ASM_S = ${LIB1ASMFUNCS:S/$/.So/} +ASM_S = ${LIB1ASMFUNCS:S/$/.pico/} ASM_V = ${LIB1ASMFUNCS:S/$/.vis/} -SOBJS += ${LIB1ASMFUNCS:S/$/.So/} +SOBJS += ${LIB1ASMFUNCS:S/$/.pico/} ${ASM_T}: ${LIB1ASMSRC} ${.PREFIX}.vis ${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \ @@ -323,7 +323,7 @@ CLEANFILES += ${ASM_V} ${ASM_V:R:S/$/.vo/} # EH_OBJS_T = ${LIB2ADDEHSTATIC:R:S/$/.o/} EH_OBJS_P = ${LIB2ADDEHSTATIC:R:S/$/.po/} -EH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.So/} +EH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.pico/} EH_CFLAGS = -fexceptions -D__GLIBC__=3 -DElfW=__ElfN .if ${TARGET_CPUARCH} != "riscv64" # RISCVTODO: unwinding support @@ -337,7 +337,7 @@ ${_src:R:S/$/.po/}: ${_src} ${COMMONHDRS} ${CC_P} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} .endfor .for _src in ${LIB2ADDEHSHARED:M*.c} -${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS} +${_src:R:S/$/.pico/}: ${_src} ${COMMONHDRS} ${CC_S} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} .endfor diff --git a/gnu/lib/libgcov/Makefile b/gnu/lib/libgcov/Makefile index 65d0fdb..740b110 100644 --- a/gnu/lib/libgcov/Makefile +++ b/gnu/lib/libgcov/Makefile @@ -35,7 +35,7 @@ SYMS = _gcov _gcov_merge_add _gcov_merge_single _gcov_merge_delta \ OBJS= ${SYMS:S/$/.o/} OBJS_T= ${SYMS:S/$/.o/} OBJS_P= ${SYMS:S/$/.po/} -OBJS_S= ${SYMS:S/$/.So/} +OBJS_S= ${SYMS:S/$/.pico/} #----------------------------------------------------------------------- # diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index beb5316..935f3ff 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -4,7 +4,7 @@ # machine-independent stdlib sources .PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/stdlib ${LIBC_SRCTOP}/stdlib -MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ +MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ bsearch.c cxa_thread_atexit.c div.c exit.c getenv.c getopt.c getopt_long.c \ getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \ hsearch_r.c imaxabs.c imaxdiv.c \ @@ -16,6 +16,13 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c +# Work around an issue on case-insensitive file systems. +# libc has both _Exit.c and _exit.s and they both yield +# _exit.o (case insensitively speaking). +CLEANFILES+=C99_Exit.c +C99_Exit.c: ${LIBC_SRCTOP}/stdlib/_Exit.c .NOMETA + ln -sf ${.ALLSRC} ${.TARGET} + SYM_MAPS+= ${LIBC_SRCTOP}/stdlib/Symbol.map # machine-dependent stdlib sources diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index 14c9cbb..a75c9d2 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -76,7 +76,7 @@ historyn.c: makelist Makefile sh ${.CURDIR}/makelist -n history.c > ${.TARGET} # minimal dependency to make "make depend" optional -editline.o editline.po editline.So editline.ln: \ +editline.o editline.po editline.pico editline.ln: \ common.h emacs.h fcns.c fcns.h help.c help.h vi.h tc1.o: ${.CURDIR}/TEST/tc1.c diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile index 240718d..1e6f436 100644 --- a/lib/libprocstat/Makefile +++ b/lib/libprocstat/Makefile @@ -58,13 +58,13 @@ MLINKS+=libprocstat.3 procstat_close.3 \ .if ${MK_CDDL} != "no" CFLAGS+= -DLIBPROCSTAT_ZFS OBJS+= zfs/zfs.o -SOBJS+= zfs/zfs.So +SOBJS+= zfs/zfs.pico POBJS+= zfs/zfs.po SUBDIR= zfs zfs/zfs.o: .PHONY @cd ${.CURDIR}/zfs && ${MAKE} zfs.o -zfs/zfs.So: .PHONY - @cd ${.CURDIR}/zfs && ${MAKE} zfs.So +zfs/zfs.pico: .PHONY + @cd ${.CURDIR}/zfs && ${MAKE} zfs.pico zfs/zfs.po: .PHONY @cd ${.CURDIR}/zfs && ${MAKE} zfs.po .endif diff --git a/lib/libthr/support/Makefile.inc b/lib/libthr/support/Makefile.inc index 35a15f8..1814f8a 100644 --- a/lib/libthr/support/Makefile.inc +++ b/lib/libthr/support/Makefile.inc @@ -15,15 +15,15 @@ CFLAGS+= -I${.CURDIR}/../libc/${MACHINE_CPUARCH} SYSCALLS= thr_new SYSCALL_SRC= ${SYSCALLS:S/$/.S/} -SYSCALL_OBJ= ${SYSCALLS:S/$/.So/} +SYSCALL_OBJ= ${SYSCALLS:S/$/.pico/} ${SYSCALL_SRC}: printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' > ${.TARGET} LIBC_OBJS= -SOBJS+= thr_libc.So +SOBJS+= thr_libc.pico CLEANFILES+= ${SYSCALL_SRC} ${SYSCALL_OBJ} ${LIBC_OBJS} -thr_libc.So: ${SYSCALL_OBJ} ${LIBC_OBJS} +thr_libc.pico: ${SYSCALL_OBJ} ${LIBC_OBJS} ${CC} -fPIC -nostdlib -o ${.TARGET} -r ${.ALLSRC} diff --git a/share/mk/bsd.README b/share/mk/bsd.README index 210e600..81aad40 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -114,7 +114,7 @@ the tree where the file gets installed. The profiled libraries are no longer built in a different directory than the regular libraries. A new suffix, ".po", is used to denote a profiled -object. +object, and ".pico" denotes a position-independent relocatable object. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 064b829..2f61d2a 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -152,8 +152,8 @@ ${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//} @rm -f ${.TARGET} ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h} .if defined(LIB) -CLEANFILES+= ${_D}.So ${_D}.po -${_D}.So: ${_DSRC} ${SOBJS:S/^${_D}.So$//} +CLEANFILES+= ${_D}.pico ${_D}.po +${_D}.pico: ${_DSRC} ${SOBJS:S/^${_D}.pico$//} @rm -f ${.TARGET} ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h} ${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//} diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index ffb03c0..f3b9f14 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -77,9 +77,9 @@ CTFFLAGS+= -g .include # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries -# .So used for PIC object files +# .pico used for PIC object files .SUFFIXES: -.SUFFIXES: .out .o .po .So .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln +.SUFFIXES: .out .o .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln .if !defined(PICFLAG) .if ${MACHINE_CPUARCH} == "sparc64" @@ -99,7 +99,7 @@ PO_FLAG=-pg ${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} -.c.So: +.c.pico: ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} @@ -109,18 +109,18 @@ PO_FLAG=-pg .cc.po .C.po .cpp.po .cxx.po: ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} -.cc.So .C.So .cpp.So .cxx.So: +.cc.pico .C.pico .cpp.pico .cxx.pico: ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .f.po: ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} ${CTFCONVERT_CMD} -.f.So: +.f.pico: ${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} ${CTFCONVERT_CMD} -.s.po .s.So: +.s.po .s.pico: ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} ${CTFCONVERT_CMD} @@ -129,7 +129,7 @@ PO_FLAG=-pg ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} -.asm.So: +.asm.pico: ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \ ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} @@ -139,7 +139,7 @@ PO_FLAG=-pg -o ${.TARGET} ${CTFCONVERT_CMD} -.S.So: +.S.pico: ${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \ -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} @@ -207,7 +207,7 @@ lib${LIB_PRIVATE}${LIB}_p.a: ${POBJS} .if defined(SHLIB_NAME) || \ defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) -SOBJS+= ${OBJS:.o=.So} +SOBJS+= ${OBJS:.o=.pico} DEPENDOBJS+= ${SOBJS} CLEANFILES+= ${SOBJS} .endif @@ -430,7 +430,7 @@ OBJS_DEPEND_GUESS.${_S:R}.po+= ${_S} .if defined(SHLIB_NAME) || \ defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) .for _S in ${SRCS:N*.[hly]} -OBJS_DEPEND_GUESS.${_S:R}.So+= ${_S} +OBJS_DEPEND_GUESS.${_S:R}.pico+= ${_S} .endfor .endif diff --git a/share/mk/meta.autodep.mk b/share/mk/meta.autodep.mk index 7095b1f..7df58bc 100644 --- a/share/mk/meta.autodep.mk +++ b/share/mk/meta.autodep.mk @@ -23,7 +23,7 @@ __${_this}__: .NOTMAIN .if defined(SRCS) # it would be nice to be able to query .SUFFIXES -OBJ_EXTENSIONS+= .o .po .lo .So +OBJ_EXTENSIONS+= .o .po .lo .pico # explicit dependencies help short-circuit .SUFFIX searches SRCS_DEP_FILTER+= N*.[hly] @@ -179,7 +179,7 @@ DEPEND_SUFFIXES += .c .h .cpp .hpp .cxx .hxx .cc .hh @case "${.MAKE.META.FILES:T:M*.po.*}" in \ *.po.*) mv $@.${.MAKE.PID} $@;; \ *) { cat $@.${.MAKE.PID}; \ - sed 's,\.So:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \ + sed 's,\.pico:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \ rm -f $@.${.MAKE.PID};; \ esac .else @@ -244,7 +244,7 @@ META_FILES = *.meta .elif ${OPTIMIZE_OBJECT_META_FILES:Uno:tl} == "no" META_FILES = ${.MAKE.META.FILES:T:N.depend*:O:u} .else -# if we have 1000's of .o.meta, .So.meta etc we need only look at one set +# if we have 1000's of .o.meta, .pico.meta etc we need only look at one set # it is left as an exercise for the reader to work out what this does META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O:u} \ ${.MAKE.META.FILES:T:M*.${.MAKE.META.FILES:M*o.meta:R:E:O:u:[1]}.meta:O:u} diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index f44645c..128e47d 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -165,7 +165,7 @@ ${mfile:T:S/.m$/.h/}: ${mfile} .endfor kernel-clean: - rm -f *.o *.so *.So *.ko *.s eddep errs \ + rm -f *.o *.so *.pico *.ko *.s eddep errs \ ${FULLKERNEL} ${KERNEL_KO} ${KERNEL_KO}.debug \ linterrs tags vers.c \ vnode_if.c vnode_if.h vnode_if_newproto.h vnode_if_typedef.h \ @@ -180,9 +180,9 @@ lint: ${LNFILES} # dynamic references. We could probably do a '-Bforcedynamic' mode like # in the a.out ld. For now, this works. HACK_EXTRA_FLAGS?= -shared -hack.So: Makefile +hack.pico: Makefile :> hack.c - ${CC} ${HACK_EXTRA_FLAGS} -nostdlib hack.c -o hack.So + ${CC} ${HACK_EXTRA_FLAGS} -nostdlib hack.c -o hack.pico rm -f hack.c assym.s: $S/kern/genassym.sh genassym.o diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 6b2bd14..a679ac0 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -176,7 +176,7 @@ SYSTEM_CFILES= config.c env.c hints.c vnode_if.c SYSTEM_DEP= Makefile ${SYSTEM_OBJS} SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS} SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o} -SYSTEM_OBJS+= hack.So +SYSTEM_OBJS+= hack.pico MD_ROOT_SIZE_CONFIGURED!= grep MD_ROOT_SIZE opt_md.h || true ; echo .if ${MFS_IMAGE:Uno} != "no" diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile b/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile index 57f3eab..80349ca 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile @@ -73,7 +73,7 @@ LIBADD= kvm devinfo m geom memstat .include -printcap.So: printcap.c +printcap.pico: printcap.c ${CC} ${PICFLAG} -DPIC ${CFLAGS:C/^-W.*//} -c ${.IMPSRC} -o ${.TARGET} smilint: -- cgit v1.1