public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Adding -z nonow to complement -z now
@ 2006-06-12 18:49 Kevin F. Quinn
  2006-06-12 18:54 ` Olivier Galibert
  2006-06-13  1:59 ` Alan Modra
  0 siblings, 2 replies; 8+ messages in thread
From: Kevin F. Quinn @ 2006-06-12 18:49 UTC (permalink / raw)
  To: binutils; +Cc: toolchain


[-- Attachment #1.1: Type: text/plain, Size: 739 bytes --]

Hi.

Attached is a little patch that adds '-z nonow' as the opposite of '-z
now'.  Could it be considered for inclusion, please?

Although some might consider it pointless, it would be very useful to
us (Gentoo Hardened project).  We flip the default when building with
gcc to set -z now by default.  Our current method of undoing this
(which we need to do very occasionally) is via an extra option handled
in a gcc specs file; the downside here is that libtool in particular
filters our option because it doesn't recognise it.  With this, we can
pass '-Wl,-z,nonow' in LDFLAGS and libtool pays attention.

If there's anything further I need to do to make this acceptable,
please let me know.

Thanks
-- 
Kevin F. Quinn

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: binutils-060612-znonow.patch --]
[-- Type: text/x-patch; name=binutils-060612-znonow.patch, Size: 571 bytes --]

	Trivial patch to add "-z nonow" as an inverse to "-z now"

--- ld/emultempl/elf32.em.orig	2006-06-03 04:45:26.000000000 +0200
+++ ld/emultempl/elf32.em	2006-06-12 19:51:13.000000000 +0200
@@ -1826,6 +1826,11 @@
 	  link_info.flags |= (bfd_vma) DF_BIND_NOW;
 	  link_info.flags_1 |= (bfd_vma) DF_1_NOW;
 	}
+      else if (strcmp (optarg, "nonow") == 0)
+	{
+	  link_info.flags &= ~((bfd_vma) DF_BIND_NOW);
+	  link_info.flags_1 &= ~((bfd_vma) DF_1_NOW);
+	}
       else if (strcmp (optarg, "origin") == 0)
 	{
 	  link_info.flags |= (bfd_vma) DF_ORIGIN;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding -z nonow to complement -z now
  2006-06-12 18:49 Adding -z nonow to complement -z now Kevin F. Quinn
@ 2006-06-12 18:54 ` Olivier Galibert
  2006-06-12 19:56   ` Kevin F. Quinn
  2006-06-13  1:59 ` Alan Modra
  1 sibling, 1 reply; 8+ messages in thread
From: Olivier Galibert @ 2006-06-12 18:54 UTC (permalink / raw)
  To: Kevin F. Quinn; +Cc: binutils, toolchain

On Mon, Jun 12, 2006 at 08:00:03PM +0200, Kevin F. Quinn wrote:
> Although some might consider it pointless, it would be very useful to
> us (Gentoo Hardened project).  We flip the default when building with
> gcc to set -z now by default.  Our current method of undoing this
> (which we need to do very occasionally) is via an extra option handled
> in a gcc specs file; the downside here is that libtool in particular
> filters our option because it doesn't recognise it.  With this, we can
> pass '-Wl,-z,nonow' in LDFLAGS and libtool pays attention.

Why don't you fix libtool?

  OG.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding -z nonow to complement -z now
  2006-06-12 18:54 ` Olivier Galibert
@ 2006-06-12 19:56   ` Kevin F. Quinn
  0 siblings, 0 replies; 8+ messages in thread
From: Kevin F. Quinn @ 2006-06-12 19:56 UTC (permalink / raw)
  To: Olivier Galibert; +Cc: binutils, toolchain

[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]

On Mon, 12 Jun 2006 20:48:10 +0200
Olivier Galibert <galibert@pobox.com> wrote:

> On Mon, Jun 12, 2006 at 08:00:03PM +0200, Kevin F. Quinn wrote:
> > Although some might consider it pointless, it would be very useful
> > to us (Gentoo Hardened project).  We flip the default when building
> > with gcc to set -z now by default.  Our current method of undoing
> > this (which we need to do very occasionally) is via an extra option
> > handled in a gcc specs file; the downside here is that libtool in
> > particular filters our option because it doesn't recognise it.
> > With this, we can pass '-Wl,-z,nonow' in LDFLAGS and libtool pays
> > attention.
> 
> Why don't you fix libtool?

The essential problem for us is that ld doesn't provide a switch-off
option to go with the switch-on option.  There are other downsides that
go with this.  I prefer to tackle that essential issue, especially as
it's trivial to do.

Is there a good reason why this shouldn't be added to ld?

-- 
Kevin F. Quinn

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding -z nonow to complement -z now
  2006-06-12 18:49 Adding -z nonow to complement -z now Kevin F. Quinn
  2006-06-12 18:54 ` Olivier Galibert
@ 2006-06-13  1:59 ` Alan Modra
  2006-06-13 17:27   ` Ulrich Drepper
  1 sibling, 1 reply; 8+ messages in thread
From: Alan Modra @ 2006-06-13  1:59 UTC (permalink / raw)
  To: Kevin F. Quinn; +Cc: binutils, toolchain

On Mon, Jun 12, 2006 at 08:00:03PM +0200, Kevin F. Quinn wrote:
> Attached is a little patch that adds '-z nonow' as the opposite of '-z
> now'.  Could it be considered for inclusion, please?

You need to provide a proper changelog entry, and describe the option in
both elf32.em:gld${EMULATION_NAME}_list_options and ld.texinfo.  With
those details fixed, this patch is fine.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding -z nonow to complement -z now
  2006-06-13  1:59 ` Alan Modra
@ 2006-06-13 17:27   ` Ulrich Drepper
  2006-06-13 18:10     ` Kevin F. Quinn
  2006-06-14  0:41     ` Kevin F. Quinn
  0 siblings, 2 replies; 8+ messages in thread
From: Ulrich Drepper @ 2006-06-13 17:27 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

Alan Modra wrote:
> On Mon, Jun 12, 2006 at 08:00:03PM +0200, Kevin F. Quinn wrote:
>> Attached is a little patch that adds '-z nonow' as the opposite of '-z
>> now'.  Could it be considered for inclusion, please?
> 
> You need to provide a proper changelog entry, and describe the option in
> [...]

You cannot honestly consider allowing a patch introducing -z nonow.
What is the opposite to 'now' in ELF terms?  It's not 'nonow', it's 'lazy'.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding -z nonow to complement -z now
  2006-06-13 17:27   ` Ulrich Drepper
@ 2006-06-13 18:10     ` Kevin F. Quinn
  2006-06-14  0:41     ` Kevin F. Quinn
  1 sibling, 0 replies; 8+ messages in thread
From: Kevin F. Quinn @ 2006-06-13 18:10 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

On Tue, 13 Jun 2006 10:23:21 -0700
Ulrich Drepper <drepper@redhat.com> wrote:

> You cannot honestly consider allowing a patch introducing -z nonow.
> What is the opposite to 'now' in ELF terms?  It's not 'nonow', it's
> 'lazy'.

Good point, I agree - nonow is a legacy name from our side hence I never
thought to change it.  I'll work that in with the other changes Alan
asked for.

-- 
Kevin F. Quinn

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding -z nonow to complement -z now
  2006-06-13 17:27   ` Ulrich Drepper
  2006-06-13 18:10     ` Kevin F. Quinn
@ 2006-06-14  0:41     ` Kevin F. Quinn
  2006-06-14  6:07       ` Alan Modra
  1 sibling, 1 reply; 8+ messages in thread
From: Kevin F. Quinn @ 2006-06-14  0:41 UTC (permalink / raw)
  To: binutils


[-- Attachment #1.1: Type: text/plain, Size: 710 bytes --]

On Tue, 13 Jun 2006 10:23:21 -0700
Ulrich Drepper <drepper@redhat.com> wrote:

> Alan Modra wrote:
> > On Mon, Jun 12, 2006 at 08:00:03PM +0200, Kevin F. Quinn wrote:
> >> Attached is a little patch that adds '-z nonow' as the opposite of
> >> '-z now'.  Could it be considered for inclusion, please?
> > 
> > You need to provide a proper changelog entry, and describe the
> > option in [...]
> 
> You cannot honestly consider allowing a patch introducing -z nonow.
> What is the opposite to 'now' in ELF terms?  It's not 'nonow', it's
> 'lazy'.

Ok; attached is an updated patch, hopefully I've addressed issues as
required so far.  Anything more, please say.

Thanks,
-- 
Kevin F. Quinn

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: binutils-060613-zlazy.patch --]
[-- Type: text/x-patch; name=binutils-060613-zlazy.patch, Size: 2344 bytes --]

2006-06-13	Kevin F. Quinn	<kevquinn@gentoo.org>

ld/

	* ld.texinfo: document new -z lazy option, inverse of -z now

ld/emultempl/

	* elf32.em (gld${EMULATION_NAME}_list_options): update help text
	(gld${EMULATION_NAME}_handle_option): handle new option

Index: ld/ld.texinfo
===================================================================
RCS file: /cvs/src/src/ld/ld.texinfo,v
retrieving revision 1.163
diff -u -r1.163 ld.texinfo
--- ld/ld.texinfo	30 May 2006 16:45:31 -0000	1.163
+++ ld/ld.texinfo	13 Jun 2006 18:25:10 -0000
@@ -962,6 +962,12 @@
 Marks the object that its symbol table interposes before all symbols
 but the primary executable.
 
+@item lazy
+When generating an executable or shared library, mark it to tell the
+dynamic linker to defer function call resolution to the point when
+the function is called (lazy binding), rather than at load time.
+Lazy binding is the default.
+
 @item loadfltr
 Marks  the object that its filters be processed immediately at
 runtime.
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.166
diff -u -r1.166 elf32.em
--- ld/emultempl/elf32.em	3 Jun 2006 02:45:26 -0000	1.166
+++ ld/emultempl/elf32.em	13 Jun 2006 18:25:11 -0000
@@ -1826,6 +1826,11 @@
 	  link_info.flags |= (bfd_vma) DF_BIND_NOW;
 	  link_info.flags_1 |= (bfd_vma) DF_1_NOW;
 	}
+      else if (strcmp (optarg, "lazy") == 0)
+	{
+	  link_info.flags &= ~((bfd_vma) DF_BIND_NOW);
+	  link_info.flags_1 &= ~((bfd_vma) DF_1_NOW);
+	}
       else if (strcmp (optarg, "origin") == 0)
 	{
 	  link_info.flags |= (bfd_vma) DF_ORIGIN;
@@ -1909,6 +1914,7 @@
   fprintf (file, _("  -z execstack\t\tMark executable as requiring executable stack\n"));
   fprintf (file, _("  -z initfirst\t\tMark DSO to be initialized first at runtime\n"));
   fprintf (file, _("  -z interpose\t\tMark object to interpose all DSOs but executable\n"));
+  fprintf (file, _("  -z lazy\t\tMark object lazy runtime binding (default)\n"));
   fprintf (file, _("  -z loadfltr\t\tMark object requiring immediate process\n"));
   fprintf (file, _("  -z muldefs\t\tAllow multiple definitions\n"));
   fprintf (file, _("  -z nocombreloc\tDon't merge dynamic relocs into one section\n"));

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Adding -z nonow to complement -z now
  2006-06-14  0:41     ` Kevin F. Quinn
@ 2006-06-14  6:07       ` Alan Modra
  0 siblings, 0 replies; 8+ messages in thread
From: Alan Modra @ 2006-06-14  6:07 UTC (permalink / raw)
  To: Kevin F. Quinn; +Cc: binutils

On Tue, Jun 13, 2006 at 10:54:28PM +0200, Kevin F. Quinn wrote:
> Ok; attached is an updated patch, hopefully I've addressed issues as
> required so far.  Anything more, please say.

Applied.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-06-14  2:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-12 18:49 Adding -z nonow to complement -z now Kevin F. Quinn
2006-06-12 18:54 ` Olivier Galibert
2006-06-12 19:56   ` Kevin F. Quinn
2006-06-13  1:59 ` Alan Modra
2006-06-13 17:27   ` Ulrich Drepper
2006-06-13 18:10     ` Kevin F. Quinn
2006-06-14  0:41     ` Kevin F. Quinn
2006-06-14  6:07       ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).