Binutils objcopy bug (was Re: rebase segfault)

marco atzeri marco.atzeri@gmail.com
Mon Mar 4 21:30:00 GMT 2013


On 3/4/2013 9:00 PM, Andrew Dunstan wrote:
>
> I have not heard a word on this in the 5 weeks or so since it was sent.
> Are you guys interested in fixing this or not?

yes Andrew,
I am working on it, unfortunately this Makefile spaghetti
is not nice to handle

probably 90% is working now, but I just found
that postgres.exe is incomplete

attached current patch for my trial

src/backend/Makefile needs some works for
postgres.exe and libpostgres.a

that I hope is the only missing bit

>
> cheers
>
> andrew

Regards
Marco
-------------- next part --------------
--- origsrc/postgresql-9.2.3/src/Makefile.shlib	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/Makefile.shlib	2013-03-04 11:56:36.238271500 +0100
@@ -284,6 +284,7 @@
 endif
 
 ifeq ($(PORTNAME), cygwin)
+  LINK.shared		= $(CC) -shared
   ifdef SO_MAJOR_VERSION
     shlib		= cyg$(NAME)$(DLSUFFIX)
   endif
@@ -374,6 +375,16 @@
 
 # If SHLIB_EXPORTS is set, the rules below will build a .def file from
 # that.  Else we build a temporary one here.
+ifeq ($(PORTNAME), cygwin)
+$(shlib): $(OBJS) | $(SHLIB_PREREQS)
+	$(CC) $(CFLAGS)  -shared -o $@  $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
+
+$(stlib): $(OBJS) | $(SHLIB_PREREQS)
+	$(LINK.static) $@ $^
+	$(RANLIB) $@
+
+
+else
 ifeq (,$(SHLIB_EXPORTS))
 DLL_DEFFILE = lib$(NAME)dll.def
 exports_file = $(DLL_DEFFILE)
@@ -390,6 +401,7 @@
 $(stlib): $(shlib) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
 	$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@
 
+endif # PORTNAME == cygwin 
 endif # PORTNAME == cygwin || PORTNAME == win32
 
 endif # enable_shared
--- origsrc/postgresql-9.2.3/src/backend/Makefile	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/backend/Makefile	2013-03-04 11:18:03.048271500 +0100
@@ -47,7 +47,6 @@
 
 all: submake-libpgport submake-schemapg postgres $(POSTGRES_IMP)
 
-ifneq ($(PORTNAME), cygwin)
 ifneq ($(PORTNAME), win32)
 ifneq ($(PORTNAME), aix)
 
@@ -56,24 +55,6 @@
 
 endif
 endif
-endif
-
-ifeq ($(PORTNAME), cygwin)
-
-postgres: $(OBJS) postgres.def libpostgres.a
-	$(DLLTOOL) --dllname $@$(X) --output-exp $@.exp --def postgres.def
-	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(call expand_subsys,$(OBJS)) $(LIBS)
-	$(DLLTOOL) --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
-	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -Wl,--stack,$(WIN32_STACK_RLIMIT) -o $@$(X) $@.exp $(call expand_subsys,$(OBJS)) $(LIBS)
-	rm -f $@.exp $@.base
-
-postgres.def: $(OBJS)
-	$(DLLTOOL) --export-all --output-def $@ $(call expand_subsys,$^)
-
-libpostgres.a: postgres.def
-	$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
-
-endif # cygwin
 
 ifeq ($(PORTNAME), win32)
 LIBS += -lsecur32
@@ -210,7 +191,7 @@
 install: all installdirs install-bin
 ifeq ($(PORTNAME), cygwin)
 ifeq ($(MAKE_DLL), true)
-	$(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a'
+#	$(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a'
 endif
 endif
 ifeq ($(PORTNAME), win32)
--- origsrc/postgresql-9.2.3/src/bin/pg_basebackup/Makefile	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/bin/pg_basebackup/Makefile	2013-03-04 11:12:39.523271500 +0100
@@ -16,6 +16,8 @@
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+LIBS += $(LIBS) $(LDAP_LIBS_BE)
+
 override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
 
 OBJS=receivelog.o streamutil.o $(WIN32RES)
--- origsrc/postgresql-9.2.3/src/bin/pg_ctl/Makefile	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/bin/pg_ctl/Makefile	2013-03-04 11:04:16.268271500 +0100
@@ -23,7 +23,7 @@
 all: pg_ctl
 
 pg_ctl: $(OBJS) | submake-libpq submake-libpgport
-	$(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+	$(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) $(LDAP_LIBS_BE)
 
 install: all installdirs
 	$(INSTALL_PROGRAM) pg_ctl$(X) '$(DESTDIR)$(bindir)/pg_ctl$(X)'
--- origsrc/postgresql-9.2.3/src/bin/pg_dump/Makefile	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/bin/pg_dump/Makefile	2013-03-04 11:10:40.034271500 +0100
@@ -12,10 +12,13 @@
 PGFILEDESC = "pg_dump/pg_restore/pg_dumpall - backup and restore PostgreSQL databases"
 PGAPPICON=win32
 
+
 subdir = src/bin/pg_dump
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+LIBS += $(LIBS) $(LDAP_LIBS_BE)
+
 override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
 
 OBJS=	pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
@@ -30,7 +33,7 @@
 all: pg_dump pg_restore pg_dumpall
 
 pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(KEYWRDOBJS) | submake-libpq submake-libpgport
-	$(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(KEYWRDOBJS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+	$(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(KEYWRDOBJS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) 
 
 pg_restore: pg_restore.o $(OBJS) $(KEYWRDOBJS) | submake-libpq submake-libpgport
 	$(CC) $(CFLAGS) pg_restore.o $(KEYWRDOBJS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
--- origsrc/postgresql-9.2.3/src/bin/psql/Makefile	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/bin/psql/Makefile	2013-03-04 11:11:05.859271500 +0100
@@ -16,6 +16,8 @@
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+LIBS += $(LIBS) $(LDAP_LIBS_BE)
+
 REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref
 
 override CPPFLAGS := -I. -I$(srcdir) -I$(libpq_srcdir) -I$(top_srcdir)/src/bin/pg_dump $(CPPFLAGS)
--- origsrc/postgresql-9.2.3/src/bin/scripts/Makefile	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/bin/scripts/Makefile	2013-03-04 11:11:44.367271500 +0100
@@ -16,6 +16,8 @@
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+LIBS += $(LIBS) $(LDAP_LIBS_BE)
+
 PROGRAMS = createdb createlang createuser dropdb droplang dropuser clusterdb vacuumdb reindexdb
 
 override CPPFLAGS := -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir) $(CPPFLAGS)
--- origsrc/postgresql-9.2.3/src/interfaces/libpq/Makefile	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/interfaces/libpq/Makefile	2013-03-04 11:03:01.935271500 +0100
@@ -27,7 +27,7 @@
 # Need to recompile any external C files because we need
 # all object files to use the same compile flags as libpq; some
 # platforms require special flags.
-LIBS := $(LIBS:-lpgport=)
+LIBS := $(LIBS:-lpgport=) $(LDAP_LIBS_BE)
 
 # We can't use Makefile variables here because the MSVC build system scrapes
 # OBJS from this file.
--- origsrc/postgresql-9.2.3/src/makefiles/Makefile.cygwin	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/makefiles/Makefile.cygwin	2013-02-08 06:49:00.645766200 +0100
@@ -1,6 +1,4 @@
 # src/makefiles/Makefile.cygwin
-DLLTOOL= dlltool
-DLLWRAP= dllwrap
 ifdef PGXS
 BE_DLLLIBS= -L$(libdir) -lpostgres
 else
@@ -40,6 +38,4 @@
 
 # Rule for building a shared library from a single .o file
 %.dll: %.o
-	$(DLLTOOL) --export-all --output-def $*.def $<
-	$(DLLWRAP) -o $@ --def $*.def $< $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)
-	rm -f $*.def
+	 $(CC) $(CFLAGS)  -shared -o $@ $<  $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)
--- origsrc/postgresql-9.2.3/src/makefiles/pgxs.mk	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/makefiles/pgxs.mk	2013-03-03 22:40:26.148157400 +0100
@@ -296,5 +296,5 @@
 
 ifdef PROGRAM
 $(PROGRAM): $(OBJS)
-	$(CC) $(CFLAGS) $(OBJS) $(PG_LIBS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+	$(CC) $(CFLAGS) $(OBJS) $(PG_LIBS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) $(LDAP_LIBS_BE) -o $@$(X)
 endif
--- origsrc/postgresql-9.2.3/src/port/Makefile	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/port/Makefile	2013-03-04 10:59:59.686271500 +0100
@@ -28,7 +28,7 @@
 include $(top_builddir)/src/Makefile.global
 
 override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
-LIBS += $(PTHREAD_LIBS)
+LIBS += $(PTHREAD_LIBS) $(LDAP_LIBS_BE)
 
 OBJS = $(LIBOBJS) chklocale.o dirmod.o erand48.o exec.o fls.o inet_net_ntop.o \
 	noblock.o path.o pgcheckdir.o pg_crc.o pgmkdirp.o pgsleep.o \
-------------- next part --------------
--- origsrc/postgresql-9.2.3/src/test/regress/parallel_schedule	2013-02-04 22:28:13.000000000 +0100
+++ src/postgresql-9.2.3/src/test/regress/parallel_schedule	2013-02-08 07:07:03.526595700 +0100
@@ -13,7 +13,8 @@
 # ----------
 # The first group of parallel tests
 # ----------
-test: boolean char name varchar text int2 int4 int8 oid float4 float8 bit numeric txid uuid enum money rangetypes
+test: boolean char name varchar text int2 int4 int8 oid 
+test: float4 float8 bit numeric txid uuid enum money rangetypes
 
 # Depends on things setup during char, varchar and text
 test: strings
@@ -23,7 +24,8 @@
 # ----------
 # The second group of parallel tests
 # ----------
-test: point lseg box path polygon circle date time timetz timestamp timestamptz interval abstime reltime tinterval inet macaddr tstypes comments
+test: point lseg box path polygon circle date time timetz timestamp 
+test: timestamptz interval abstime reltime tinterval inet macaddr tstypes comments
 
 # ----------
 # Another group of parallel tests
@@ -78,7 +80,10 @@
 # ----------
 # Another group of parallel tests
 # ----------
-test: select_into select_distinct select_distinct_on select_implicit select_having subselect union case join aggregates transactions random portals arrays btree_index hash_index update namespace prepared_xacts delete
+# test: select_into select_distinct select_distinct_on select_implicit select_having subselect union case join aggregates transactions random portals arrays btree_index hash_index update namespace prepared_xacts delete
+test: select_into select_distinct select_distinct_on select_implicit select_having subselect union case
+test: join aggregates transactions random portals arrays btree_index hash_index update namespace delete
+# test: prepared_xacts 
 
 # ----------
 # Another group of parallel tests
@@ -92,14 +97,18 @@
 # ----------
 # Another group of parallel tests
 # ----------
-test: select_views portals_p2 foreign_key cluster dependency guc bitmapops combocid tsearch tsdicts foreign_data window xmlmap functional_deps advisory_lock json
+#test: select_views portals_p2 foreign_key cluster dependency guc bitmapops combocid tsearch tsdicts foreign_data window xmlmap functional_deps advisory_lock json
+test: select_views portals_p2 foreign_key cluster dependency guc bitmapops 
+test: combocid tsearch tsdicts foreign_data window xmlmap functional_deps advisory_lock json
 
 # ----------
 # Another group of parallel tests
 # NB: temp.sql does a reconnect which transiently uses 2 connections,
 # so keep this parallel group to at most 19 tests
 # ----------
-test: plancache limit plpgsql copy2 temp domain rangefuncs prepare without_oid conversion truncate alter_table sequence polymorphism rowtypes returning largeobject with xml
+# test: plancache limit plpgsql copy2 temp domain rangefuncs prepare without_oid conversion truncate alter_table sequence polymorphism rowtypes returning largeobject with xml
+test: plancache limit plpgsql copy2 temp domain rangefuncs prepare without_oid conversion 
+test: conversion truncate alter_table sequence polymorphism rowtypes returning largeobject with xml
 
 # run stats by itself because its delay may be insufficient under heavy load
 test: stats

-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list