Re: CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2023-09-11 Thread Joerg Sonnenberger
On Mon, Sep 11, 2023 at 12:27:25PM +1000, matthew green wrote:
> "Rin Okuyama" writes:
> > Module Name:src
> > Committed By:   rin
> > Date:   Mon Sep 11 01:54:18 UTC 2023
> >
> > Modified Files:
> > src/external/gpl3/binutils/dist/ld/emultempl: aarch64elf.em armelf.em
> > elf.em
> >
> > Log Message:
> > ld: Enable --copy-dt-needed-entries by default again
> 
> thanks for fixing -lcurses.
> 
> can we put this into bsd.*.mk instead?
> 
> ie, if we want this, declare it explicitly, rather than
> reply upon patched binutils?  (this is eg, unfriendly to
> EXTERNAL_TOOLCHAIN etc.)

We (TNF) consider this the default a bug. Red Hat etc who've been
pushing for this mess don't, for reasons that don't really make sense.
Basically, the Linux toolchain folks decided that ELF should no longer
be recursive except it still is for every use case were performance
matters.

Joerg


Re: CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2023-09-10 Thread Rin Okuyama

On 2023/09/11 11:27, matthew green wrote:

"Rin Okuyama" writes:

Module Name:src
Committed By:   rin
Date:   Mon Sep 11 01:54:18 UTC 2023

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: aarch64elf.em armelf.em
elf.em

Log Message:
ld: Enable --copy-dt-needed-entries by default again


thanks for fixing -lcurses.

can we put this into bsd.*.mk instead?

ie, if we want this, declare it explicitly, rather than
reply upon patched binutils?  (this is eg, unfriendly to
EXTERNAL_TOOLCHAIN etc.)

if it works, of course


Thanks for your comment. Yeah, I feel this fix is too much also...

I've found that FreeBSD uses ldscript to handle curses vs terminfo problem.
I think we can resolve the problem in a similar manner.

I've sent PR lib/57615 for this:
http://gnats.netbsd.org/57615

Thanks,
rin


re: CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2023-09-10 Thread matthew green
"Rin Okuyama" writes:
> Module Name:  src
> Committed By: rin
> Date: Mon Sep 11 01:54:18 UTC 2023
>
> Modified Files:
>   src/external/gpl3/binutils/dist/ld/emultempl: aarch64elf.em armelf.em
>   elf.em
>
> Log Message:
> ld: Enable --copy-dt-needed-entries by default again

thanks for fixing -lcurses.

can we put this into bsd.*.mk instead?

ie, if we want this, declare it explicitly, rather than
reply upon patched binutils?  (this is eg, unfriendly to
EXTERNAL_TOOLCHAIN etc.)

if it works, of course


.mrg.


CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2023-09-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep 11 01:54:18 UTC 2023

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: aarch64elf.em armelf.em
elf.em

Log Message:
ld: Enable --copy-dt-needed-entries by default again

Otherwise, terminfo(3) symbols referenced from curses(3)-based applications
are not resolved, unless -lterminfo is explicitly specified.

See, e.g., PR lib/57592

We had locally enabled this by default:

http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/binutils/dist/ld/emultempl/elf.em#rev1.2

But this was lost during 2.39 merge.

Thanks uwe@ for hints!


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em \
src/external/gpl3/binutils/dist/ld/emultempl/armelf.em
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/binutils/dist/ld/emultempl/elf.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em:1.8 src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em:1.9
--- src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em:1.8	Sat Dec 24 20:17:07 2022
+++ src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em	Mon Sep 11 01:54:18 2023
@@ -44,6 +44,8 @@ gld${EMULATION_NAME}_before_parse (void)
   ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
 #endif /* not TARGET_ */
   input_flags.dynamic = ${DYNAMIC_LINK-true};
+  /* XXX For NetBSD, copy-dt-needed-entries by default.  */
+  input_flags.add_DT_NEEDED_for_dynamic = true;
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`;
   link_info.check_relocs_after_open_input = true;
Index: src/external/gpl3/binutils/dist/ld/emultempl/armelf.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/armelf.em:1.8 src/external/gpl3/binutils/dist/ld/emultempl/armelf.em:1.9
--- src/external/gpl3/binutils/dist/ld/emultempl/armelf.em:1.8	Sat Dec 24 20:17:07 2022
+++ src/external/gpl3/binutils/dist/ld/emultempl/armelf.em	Mon Sep 11 01:54:18 2023
@@ -57,6 +57,8 @@ gld${EMULATION_NAME}_before_parse (void)
   ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
 #endif /* not TARGET_ */
   input_flags.dynamic = ${DYNAMIC_LINK-true};
+  /* XXX For NetBSD, copy-dt-needed-entries by default.  */
+  input_flags.add_DT_NEEDED_for_dynamic = true;
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`;
   link_info.check_relocs_after_open_input = true;

Index: src/external/gpl3/binutils/dist/ld/emultempl/elf.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/elf.em:1.3 src/external/gpl3/binutils/dist/ld/emultempl/elf.em:1.4
--- src/external/gpl3/binutils/dist/ld/emultempl/elf.em:1.3	Sat Dec 24 20:17:07 2022
+++ src/external/gpl3/binutils/dist/ld/emultempl/elf.em	Mon Sep 11 01:54:18 2023
@@ -81,6 +81,8 @@ gld${EMULATION_NAME}_before_parse (void)
 {
   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
   input_flags.dynamic = ${DYNAMIC_LINK-true};
+  /* XXX For NetBSD, copy-dt-needed-entries by default.  */
+  input_flags.add_DT_NEEDED_for_dynamic = true;
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`;
   link_info.check_relocs_after_open_input = true;



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2023-09-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep 11 01:54:18 UTC 2023

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: aarch64elf.em armelf.em
elf.em

Log Message:
ld: Enable --copy-dt-needed-entries by default again

Otherwise, terminfo(3) symbols referenced from curses(3)-based applications
are not resolved, unless -lterminfo is explicitly specified.

See, e.g., PR lib/57592

We had locally enabled this by default:

http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/binutils/dist/ld/emultempl/elf.em#rev1.2

But this was lost during 2.39 merge.

Thanks uwe@ for hints!


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em \
src/external/gpl3/binutils/dist/ld/emultempl/armelf.em
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/binutils/dist/ld/emultempl/elf.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2020-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 16 15:47:20 UTC 2020

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf.em

Log Message:
Restore --copy-dt-needed as default. There is too much fallout in pkgsrc
mainly from -lcurses needing -lterminfo.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/binutils/dist/ld/emultempl/elf.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emultempl/elf.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/elf.em:1.1.1.1 src/external/gpl3/binutils/dist/ld/emultempl/elf.em:1.2
--- src/external/gpl3/binutils/dist/ld/emultempl/elf.em:1.1.1.1	Fri Apr  3 19:40:02 2020
+++ src/external/gpl3/binutils/dist/ld/emultempl/elf.em	Thu Apr 16 11:47:19 2020
@@ -79,6 +79,7 @@ gld${EMULATION_NAME}_before_parse (void)
 {
   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
   input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
+  input_flags.add_DT_NEEDED_for_dynamic = TRUE;
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
   link_info.check_relocs_after_open_input = TRUE;



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2020-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 16 15:47:20 UTC 2020

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf.em

Log Message:
Restore --copy-dt-needed as default. There is too much fallout in pkgsrc
mainly from -lcurses needing -lterminfo.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/binutils/dist/ld/emultempl/elf.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2018-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 19 21:20:35 UTC 2018

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
don't prepend sysroots when we already have prepended it (breaks X11 binaries)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2018-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 19 21:20:35 UTC 2018

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
don't prepend sysroots when we already have prepended it (breaks X11 binaries)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emultempl/elf32.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.16 src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.17
--- src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.16	Sun May  6 10:46:58 2018
+++ src/external/gpl3/binutils/dist/ld/emultempl/elf32.em	Sat May 19 17:20:35 2018
@@ -1484,7 +1484,7 @@ fragment <

CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2018-05-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May  6 14:46:58 UTC 2018

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
fix misapplied patch


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emultempl/elf32.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.15 src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.16
--- src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.15	Sun Apr 15 16:06:03 2018
+++ src/external/gpl3/binutils/dist/ld/emultempl/elf32.em	Sun May  6 10:46:58 2018
@@ -1484,7 +1484,7 @@ fragment <

CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2018-05-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May  6 14:46:58 UTC 2018

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
fix misapplied patch


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2016-05-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May  2 23:22:39 UTC 2016

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
search for the proper variable in the sysroot case.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emultempl/elf32.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.11 src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.12
--- src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.11	Fri Jan 29 09:42:47 2016
+++ src/external/gpl3/binutils/dist/ld/emultempl/elf32.em	Mon May  2 19:22:39 2016
@@ -1289,7 +1289,7 @@ fragment by
-		   && gld${EMULATION_NAME}_search_needed (rp->name,
+		   && gld${EMULATION_NAME}_search_needed (tmpname,
 			  ,
 			  force, 1));
 	  if (tmpname != rp->name)



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2016-05-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May  2 23:22:39 UTC 2016

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
search for the proper variable in the sysroot case.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2015-02-18 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Feb 18 15:05:44 UTC 2015

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: aarch64elf.em armelf.em

Log Message:
Apply elf32.em r1.8 to the corresponding sections of armelf.em and
aarch64elf.em. Original commit message:

Recursively add DT_NEEDED entries from shared libraries if symbols are
used indirectly. This is more in line with the old GNU ld behavior, but
not exactly the desired semantic.

Patch from Martin Husemann.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em
cvs rdiff -u -r1.1.1.3 -r1.2 \
src/external/gpl3/binutils/dist/ld/emultempl/armelf.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2015-02-18 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Feb 18 15:05:44 UTC 2015

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: aarch64elf.em armelf.em

Log Message:
Apply elf32.em r1.8 to the corresponding sections of armelf.em and
aarch64elf.em. Original commit message:

Recursively add DT_NEEDED entries from shared libraries if symbols are
used indirectly. This is more in line with the old GNU ld behavior, but
not exactly the desired semantic.

Patch from Martin Husemann.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em
cvs rdiff -u -r1.1.1.3 -r1.2 \
src/external/gpl3/binutils/dist/ld/emultempl/armelf.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em:1.1.1.1 src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em:1.2
--- src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em:1.1.1.1	Sun Sep 29 13:45:51 2013
+++ src/external/gpl3/binutils/dist/ld/emultempl/aarch64elf.em	Wed Feb 18 15:05:43 2015
@@ -38,6 +38,7 @@ gld${EMULATION_NAME}_before_parse (void)
   ldfile_set_output_arch (`echo ${ARCH}`, bfd_arch_unknown);
 #endif /* not TARGET_ */
   input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
+  input_flags.add_DT_NEEDED_for_dynamic = TRUE;
   config.has_shared = `if test -n $GENERATE_SHLIB_SCRIPT ; then echo TRUE ; else echo FALSE ; fi`;
   config.separate_code = `if test x${SEPARATE_CODE} = xyes ; then echo TRUE ; else echo FALSE ; fi`;
 }

Index: src/external/gpl3/binutils/dist/ld/emultempl/armelf.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/armelf.em:1.1.1.3 src/external/gpl3/binutils/dist/ld/emultempl/armelf.em:1.2
--- src/external/gpl3/binutils/dist/ld/emultempl/armelf.em:1.1.1.3	Sun Sep 29 13:45:51 2013
+++ src/external/gpl3/binutils/dist/ld/emultempl/armelf.em	Wed Feb 18 15:05:43 2015
@@ -51,6 +51,7 @@ gld${EMULATION_NAME}_before_parse (void)
   ldfile_set_output_arch (`echo ${ARCH}`, bfd_arch_unknown);
 #endif /* not TARGET_ */
   input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
+  input_flags.add_DT_NEEDED_for_dynamic = TRUE;
   config.has_shared = `if test -n $GENERATE_SHLIB_SCRIPT ; then echo TRUE ; else echo FALSE ; fi`;
   config.separate_code = `if test x${SEPARATE_CODE} = xyes ; then echo TRUE ; else echo FALSE ; fi`;
 }



Re: CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2015-02-18 Thread Joerg Sonnenberger
On Wed, Feb 18, 2015 at 03:05:44PM +, Joerg Sonnenberger wrote:
 Module Name:  src
 Committed By: joerg
 Date: Wed Feb 18 15:05:44 UTC 2015
 
 Modified Files:
   src/external/gpl3/binutils/dist/ld/emultempl: aarch64elf.em armelf.em
 
 Log Message:
 Apply elf32.em r1.8 to the corresponding sections of armelf.em and
 aarch64elf.em. Original commit message:
 
 Recursively add DT_NEEDED entries from shared libraries if symbols are
 used indirectly. This is more in line with the old GNU ld behavior, but
 not exactly the desired semantic.
 
 Patch from Martin Husemann.

Please note that this needs a make clean in src/external/gpl3/binutils
to be seen as the dependencies of the generated source files are
incomplete.

Joerg


CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2013-11-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 14 01:12:14 UTC 2013

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
CID 1102856: Fix memory leak


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emultempl/elf32.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.8 src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.9
--- src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.8	Fri Oct 25 10:28:28 2013
+++ src/external/gpl3/binutils/dist/ld/emultempl/elf32.em	Wed Nov 13 20:12:14 2013
@@ -1531,7 +1531,8 @@ gld${EMULATION_NAME}_before_allocation (
 	   a dep audit entry.  */
 	if (audit_libs  *audit_libs != '\0')
 	  {
-	char *cp = xstrdup (audit_libs);
+	char *cp, *fcp;
+	fcp = cp = xstrdup (audit_libs);
 	do
 	  {
 		int more = 0;
@@ -1549,6 +1550,7 @@ gld${EMULATION_NAME}_before_allocation (
 		cp = more ? ++cp2 : NULL;
 	  }
 	while (cp != NULL);
+	free (fcp);
 	  }
   }
 



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2013-11-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 14 01:12:14 UTC 2013

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
CID 1102856: Fix memory leak


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2013-10-25 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Oct 25 14:28:29 UTC 2013

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
Recursively add DT_NEEDED entries from shared libraries if symbols are
used indirectly. This is more in line with the old GNU ld behavior, but
not exactly the desired semantic.

Patch from Martin Husemann.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emultempl/elf32.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.7 src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.8
--- src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.7	Sun Sep 29 14:03:31 2013
+++ src/external/gpl3/binutils/dist/ld/emultempl/elf32.em	Fri Oct 25 14:28:28 2013
@@ -103,6 +103,7 @@ gld${EMULATION_NAME}_before_parse (void)
 {
   ldfile_set_output_arch (${OUTPUT_ARCH}, bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
   input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
+  input_flags.add_DT_NEEDED_for_dynamic = TRUE;
   config.has_shared = `if test -n $GENERATE_SHLIB_SCRIPT ; then echo TRUE ; else echo FALSE ; fi`;
   config.separate_code = `if test x${SEPARATE_CODE} = xyes ; then echo TRUE ; else echo FALSE ; fi`;
 }



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2013-10-25 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Oct 25 14:28:29 UTC 2013

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
Recursively add DT_NEEDED entries from shared libraries if symbols are
used indirectly. This is more in line with the old GNU ld behavior, but
not exactly the desired semantic.

Patch from Martin Husemann.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2013-06-25 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Jun 25 19:38:55 UTC 2013

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
PR 47922: Properly resolve DT_NEEDED entries under sysroot and don't
accidently try the installed system.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emultempl/elf32.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.5 src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.6
--- src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.5	Tue Aug  7 01:09:13 2012
+++ src/external/gpl3/binutils/dist/ld/emultempl/elf32.em	Tue Jun 25 19:38:54 2013
@@ -452,15 +452,25 @@ fragment EOF
 
 static bfd_boolean
 gld${EMULATION_NAME}_search_needed (const char *path,
-struct dt_needed *n, int force)
+struct dt_needed *n, int force, int prepend_sysroot)
 {
   const char *s;
   const char *name = n-name;
   size_t len;
   struct dt_needed needed;
 
-  if (name[0] == '/')
+  if (name[0] == '/') {
+if (prepend_sysroot  ld_sysroot) {
+  bfd_boolean rv;
+  needed.by = n-by;
+  char *filename= concat(ld_sysroot, n-name, (const char *)NULL);
+  needed.name = filename;
+  rv = gld${EMULATION_NAME}_try_needed (needed, force);
+  free(filename);
+  return rv;
+}
 return gld${EMULATION_NAME}_try_needed (n, force);
+  }
 
   if (path == NULL || *path == '\0')
 return FALSE;
@@ -499,6 +509,13 @@ gld${EMULATION_NAME}_search_needed (cons
 	}
   strcpy (sset, name);
 
+  if (prepend_sysroot  filename[0] == '=')
+abort();
+  if (filename[0] == '/'  prepend_sysroot  ld_sysroot) {
+char *filename2 = concat(ld_sysroot, filename, (const char *)NULL);
+free(filename);
+filename = filename2;
+  }
   needed.name = filename;
   if (gld${EMULATION_NAME}_try_needed (needed, force))
 	return TRUE;
@@ -613,7 +630,7 @@ gld${EMULATION_NAME}_check_ld_elf_hints 
   needed.by = NULL;
   needed.name = name;
   return gld${EMULATION_NAME}_search_needed (ld_elf_hints,  needed,
-	 force);
+	 force, 0);
 }
 EOF
 # FreeBSD
@@ -824,7 +841,7 @@ gld${EMULATION_NAME}_check_ld_so_conf (c
 
   needed.by = NULL;
   needed.name = name;
-  return gld${EMULATION_NAME}_search_needed (ld_so_conf, needed, force);
+  return gld${EMULATION_NAME}_search_needed (ld_so_conf, needed, force, 0);
 }
 
 EOF
@@ -1256,13 +1273,13 @@ fi
 fragment EOF
 
 	  if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link,
-		  n, force))
+		  n, force, 0))
 	break;
 EOF
 if [ x${USE_LIBPATH} = xyes ] ; then
 fragment EOF
 	  if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
-		  n, force))
+		  n, force, 1))
 	break;
 EOF
 fi
@@ -1273,11 +1290,11 @@ fragment EOF
 	{
 	  lib_path = (const char *) getenv (LD_RUN_PATH);
 	  if (gld${EMULATION_NAME}_search_needed (lib_path, n,
-		  force))
+		  force, 0))
 		break;
 	}
 	  lib_path = (const char *) getenv (LD_LIBRARY_PATH);
-	  if (gld${EMULATION_NAME}_search_needed (lib_path, n, force))
+	  if (gld${EMULATION_NAME}_search_needed (lib_path, n, force, 0))
 	break;
 EOF
 fi
@@ -1287,12 +1304,10 @@ fragment EOF
 	  rp = bfd_elf_get_runpath_list (link_info.output_bfd, link_info);
 	  for (; !found  rp != NULL; rp = rp-next)
 	{
-	  char *tmpname = gld${EMULATION_NAME}_add_sysroot (rp-name);
 	  found = (rp-by == l-by
-		gld${EMULATION_NAME}_search_needed (tmpname,
+		gld${EMULATION_NAME}_search_needed (rp-name,
 			  n,
-			  force));
-	  free (tmpname);
+			  force, 1));
 	}
 	  if (found)
 	break;



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2013-06-25 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Jun 25 19:38:55 UTC 2013

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
PR 47922: Properly resolve DT_NEEDED entries under sysroot and don't
accidently try the installed system.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2012-08-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Aug  7 01:09:13 UTC 2012

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
Remove code that should be have excised a long time ago.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emultempl/elf32.em
diff -u src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.4 src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.5
--- src/external/gpl3/binutils/dist/ld/emultempl/elf32.em:1.4	Sun Sep 25 04:32:43 2011
+++ src/external/gpl3/binutils/dist/ld/emultempl/elf32.em	Tue Aug  7 01:09:13 2012
@@ -1929,8 +1929,7 @@ gld${EMULATION_NAME}_place_orphan (asect
 	|| (!iself  CONST_STRNEQ (secname, .rel)))
 	(s-flags  SEC_LOAD) != 0)
 place = hold[orphan_rel];
-  else if ((s-flags  SEC_CODE) == 0
-	hold[orphan_rodata].os != NULL)
+  else if ((s-flags  SEC_CODE) == 0)
 place = hold[orphan_rodata];
   else
 place = hold[orphan_text];



CVS commit: src/external/gpl3/binutils/dist/ld/emultempl

2012-08-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Aug  7 01:09:13 UTC 2012

Modified Files:
src/external/gpl3/binutils/dist/ld/emultempl: elf32.em

Log Message:
Remove code that should be have excised a long time ago.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/binutils/dist/ld/emultempl/elf32.em

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.