public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add documentation of warning if byte size exceeded
@ 2017-03-07  9:22 tcharding
  2017-03-07  9:42 ` Tobin C. Harding
  0 siblings, 1 reply; 4+ messages in thread
From: tcharding @ 2017-03-07  9:22 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils, Tobin C . Harding

From: Tobin C. Harding <me@tobin.cc>

GAS throws a warning if an attempt is made to declare data that
exceeds the size allocated when using directives .2byte or .4byte.

Add documentation indicating the warning and the action taken by the
assembler.

---

I see that the patch prior to this one (commit d10ef45) has caused
build fail for someone. Is there anything I can do to help rectify
that issue? 

 gas/doc/as.texinfo | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
index 0a70d7c..6f62511 100644
--- a/gas/doc/as.texinfo
+++ b/gas/doc/as.texinfo
@@ -7347,7 +7347,8 @@ instead of zero.  Using @samp{.zero} in this way would be confusing however.
 
 This directive @code{.2byte}, which is available for ELF targets, expects zero
 or more expressions, separated by commas. Each expression is assembled into the
-next two bytes.
+next two bytes.  If the expression won't fit in 2 bytes, it prints a
+warning message; and just takes the lowest order 2 bytes of the expression.
 
 @node 4byte
 @cindex @code{4byte} directive
@@ -7357,7 +7358,8 @@ next two bytes.
 
 This directive @code{.4byte}, which is available for ELF targets, expects zero
 or more expressions, separated by commas. Each expression is assembled into the
-next four bytes.
+next four bytes.  If the expression won't fit in 4 bytes, it prints a
+warning message; and just takes the lowest order 4 bytes of the expression.
 
 @node 8byte
 @cindex @code{8byte} directive
-- 
2.7.4

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

* Re: [PATCH] Add documentation of warning if byte size exceeded
  2017-03-07  9:22 [PATCH] Add documentation of warning if byte size exceeded tcharding
@ 2017-03-07  9:42 ` Tobin C. Harding
  2017-03-10 15:42   ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Tobin C. Harding @ 2017-03-07  9:42 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

On Tue, Mar 07, 2017 at 08:22:34PM +1100, tcharding wrote:
> From: Tobin C. Harding <me@tobin.cc>
> 
> GAS throws a warning if an attempt is made to declare data that
> exceeds the size allocated when using directives .2byte or .4byte.
> 
> Add documentation indicating the warning and the action taken by the
> assembler.
> 
> ---
> 
> I see that the patch prior to this one (commit d10ef45) has caused
> build fail for someone. Is there anything I can do to help rectify
> that issue? 
> 
>  gas/doc/as.texinfo | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
> index 0a70d7c..6f62511 100644
> --- a/gas/doc/as.texinfo
> +++ b/gas/doc/as.texinfo
> @@ -7347,7 +7347,8 @@ instead of zero.  Using @samp{.zero} in this way would be confusing however.
>  
>  This directive @code{.2byte}, which is available for ELF targets, expects zero
>  or more expressions, separated by commas. Each expression is assembled into the
> -next two bytes.
> +next two bytes.  If the expression won't fit in 2 bytes, it prints a
> +warning message; and just takes the lowest order 2 bytes of the expression.
>  
>  @node 4byte
>  @cindex @code{4byte} directive
> @@ -7357,7 +7358,8 @@ next two bytes.
>  
>  This directive @code{.4byte}, which is available for ELF targets, expects zero
>  or more expressions, separated by commas. Each expression is assembled into the
> -next four bytes.
> +next four bytes.  If the expression won't fit in 4 bytes, it prints a
> +warning message; and just takes the lowest order 4 bytes of the expression.
>  
>  @node 8byte
>  @cindex @code{8byte} directive
> -- 
> 2.7.4
> 

Would you like me to rebase this now after commit (ea86f53 Correct
@section placement for makeinfo 4.13) has been added?

thanks,
Tobin.

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

* Re: [PATCH] Add documentation of warning if byte size exceeded
  2017-03-07  9:42 ` Tobin C. Harding
@ 2017-03-10 15:42   ` Nick Clifton
  2017-03-10 21:58     ` Tobin C. Harding
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2017-03-10 15:42 UTC (permalink / raw)
  To: Tobin C. Harding; +Cc: Alan Modra, binutils

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

Hi Tobin,

>> GAS throws a warning if an attempt is made to declare data that
>> exceeds the size allocated when using directives .2byte or .4byte.

I have taken your patch and extended it slightly in order to tidy up
the wording.  Attached is the patch that I have committed.

>> I see that the patch prior to this one (commit d10ef45) has caused
>> build fail for someone.

I did not see this.  The documentation builds fine for me.  Are you sure 
that it is still a problem ?

Cheers
  Nick

gas/ChangeLog
2017-03-10  Tobin C. Harding  <me@tobin.cc>
	    Nick Clifton  <nickc@redhat.com>

	* doc/as.texinfo (2byte): Tidy up wording.  Add note that
	overlarge values will produce a warning message and be trunacted.
	(4byte): Likewise.


[-- Attachment #2: as.texinfo.patch --]
[-- Type: text/x-patch, Size: 2389 bytes --]

diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
index a8f014b..3b3e931 100644
--- a/gas/doc/as.texinfo
+++ b/gas/doc/as.texinfo
@@ -7345,9 +7345,11 @@ instead of zero.  Using @samp{.zero} in this way would be confusing however.
 @cindex two-byte integer
 @cindex integer, 2-byte
 
-This directive @code{.2byte}, which is available for ELF targets, expects zero
-or more expressions, separated by commas. Each expression is assembled into the
-next two bytes.
+This directive expects zero or more expressions, separated by commas.  Each
+expression is evaluated and placed in the next two bytes of the current
+section.  If an expression will not fit in two bytes, a warning message
+is displayed and the lowest two bytes of the expression's value are used.
+This directive is only available for ELF targets,
 
 @node 4byte
 @section @code{.4byte @var{expression} [, @var{expression}]*}
@@ -7355,9 +7357,11 @@ next two bytes.
 @cindex four-byte integer
 @cindex integer, 4-byte
 
-This directive @code{.4byte}, which is available for ELF targets, expects zero
-or more expressions, separated by commas. Each expression is assembled into the
-next four bytes.
+This directive expects zero or more expressions, separated by commas.  Each
+expression is evaluated and placed in the next four bytes of the current
+section.  If an expression will not fit in four bytes, a warning message
+is displayed and the lowest four bytes of the expression's value are used.
+This directive is only available for ELF targets,
 
 @node 8byte
 @section @code{.8byte @var{expression} [, @var{expression}]*}
@@ -7365,10 +7369,11 @@ next four bytes.
 @cindex eight-byte integer
 @cindex integer, 8-byte
 
-This directive @code{.8byte}, which is available for ELF targets, expects zero
-or more bignums, separated by commas.  For each bignum, it emits
-an 8-byte integer.  If the bignum won't fit in 8 bytes, it prints a
-warning message; and just takes the lowest order 8 bytes of the bignum.
+This directive expects zero or more expressions, separated by commas.  Each
+expression is evaluated and the resulting bignum is placed in the next eight
+bytes of the current section.  If an expression will not fit in eight bytes, a
+warning message is displayed and the lowest eight bytes of the expression's
+value are used.  This directive is only available for ELF targets,
 @end ifset
 
 @node Deprecated

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

* Re: [PATCH] Add documentation of warning if byte size exceeded
  2017-03-10 15:42   ` Nick Clifton
@ 2017-03-10 21:58     ` Tobin C. Harding
  0 siblings, 0 replies; 4+ messages in thread
From: Tobin C. Harding @ 2017-03-10 21:58 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Alan Modra, binutils

On Fri, Mar 10, 2017 at 03:41:57PM +0000, Nick Clifton wrote:
> Hi Tobin,
> 
> >> GAS throws a warning if an attempt is made to declare data that
> >> exceeds the size allocated when using directives .2byte or .4byte.
> 
> I have taken your patch and extended it slightly in order to tidy up
> the wording.  Attached is the patch that I have committed.

Excellent, thanks.

> 
> >> I see that the patch prior to this one (commit d10ef45) has caused
> >> build fail for someone.
> 
> I did not see this.  The documentation builds fine for me.  Are you sure 
> that it is still a problem ?

This has been resolved (by Allan).

> 
> Cheers
>   Nick

Cheers,
Tobin.

> 
> gas/ChangeLog
> 2017-03-10  Tobin C. Harding  <me@tobin.cc>
> 	    Nick Clifton  <nickc@redhat.com>
> 
> 	* doc/as.texinfo (2byte): Tidy up wording.  Add note that
> 	overlarge values will produce a warning message and be trunacted.
> 	(4byte): Likewise.
> 

> diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
> index a8f014b..3b3e931 100644
> --- a/gas/doc/as.texinfo
> +++ b/gas/doc/as.texinfo
> @@ -7345,9 +7345,11 @@ instead of zero.  Using @samp{.zero} in this way would be confusing however.
>  @cindex two-byte integer
>  @cindex integer, 2-byte
>  
> -This directive @code{.2byte}, which is available for ELF targets, expects zero
> -or more expressions, separated by commas. Each expression is assembled into the
> -next two bytes.
> +This directive expects zero or more expressions, separated by commas.  Each
> +expression is evaluated and placed in the next two bytes of the current
> +section.  If an expression will not fit in two bytes, a warning message
> +is displayed and the lowest two bytes of the expression's value are used.
> +This directive is only available for ELF targets,
>  
>  @node 4byte
>  @section @code{.4byte @var{expression} [, @var{expression}]*}
> @@ -7355,9 +7357,11 @@ next two bytes.
>  @cindex four-byte integer
>  @cindex integer, 4-byte
>  
> -This directive @code{.4byte}, which is available for ELF targets, expects zero
> -or more expressions, separated by commas. Each expression is assembled into the
> -next four bytes.
> +This directive expects zero or more expressions, separated by commas.  Each
> +expression is evaluated and placed in the next four bytes of the current
> +section.  If an expression will not fit in four bytes, a warning message
> +is displayed and the lowest four bytes of the expression's value are used.
> +This directive is only available for ELF targets,
>  
>  @node 8byte
>  @section @code{.8byte @var{expression} [, @var{expression}]*}
> @@ -7365,10 +7369,11 @@ next four bytes.
>  @cindex eight-byte integer
>  @cindex integer, 8-byte
>  
> -This directive @code{.8byte}, which is available for ELF targets, expects zero
> -or more bignums, separated by commas.  For each bignum, it emits
> -an 8-byte integer.  If the bignum won't fit in 8 bytes, it prints a
> -warning message; and just takes the lowest order 8 bytes of the bignum.
> +This directive expects zero or more expressions, separated by commas.  Each
> +expression is evaluated and the resulting bignum is placed in the next eight
> +bytes of the current section.  If an expression will not fit in eight bytes, a
> +warning message is displayed and the lowest eight bytes of the expression's
> +value are used.  This directive is only available for ELF targets,
>  @end ifset
>  
>  @node Deprecated


-- 
Tobin Harding
http://tobin.cc

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

end of thread, other threads:[~2017-03-10 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-07  9:22 [PATCH] Add documentation of warning if byte size exceeded tcharding
2017-03-07  9:42 ` Tobin C. Harding
2017-03-10 15:42   ` Nick Clifton
2017-03-10 21:58     ` Tobin C. Harding

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).