public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v9 0/11 Add support for CRC64 generation in linker
@ 2023-03-02 22:03 binutils
  2023-03-02 22:03 ` [PATCH v9 01/11] [gdb/testsuite] Fix gdb.rust/watch.exp on ppc64le binutils
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:03 UTC (permalink / raw)
  To: binutils; +Cc: nickc

Patchset IX
Endian:
Default small endian.
Override with switches: -BE, -LE
Override in label using [#BE] and [#LE]

  DIGEST "<label>[#BE|#LE]" "CRC32"              (start, end)
  DIGEST "<label>[#BE|#LE]" "CRC64-ECMA"         (start, end)
  DIGEST "<label>[#BE|#LE]" "CRC64-GO-ISO"       (start, end)
  DIGEST "<label>[#BE|#LE]" "CRC64-GO-ISO-R"     (start, end)
  DIGEST "<label>[#BE|#LE]" "CRC64-WE"           (start, end)
  DIGEST "<label>[#BE|#LE]" "CRC64-XZ"           (start, end)
  DIGEST "<label>[#BE|#LE]"  POLY (<params>)     (start, end)
  DIGEST TABLE "<label>[#BE|#LE]"
  DIGEST SECTION "<section>"

Improve error messages. Some warnings are now errors.
Handle reported errors.
Keep DIGEST SECTION "name", but the whole feature should be deleted.

Patchset VIII
Memory in testsuite reduced to 16kB ROM and 4 kB RAM
All situated in the first 64 KB.

Patchset VII

Rebased against master
Fixed whitespace errors
Run indent on CRC files
Moved license to ld directory and renamed to COPYING.<website>
Added comments to COPYING.www.sunshine2k.de explaining what it is.

Patchset six
Commands changes so you always get little endian
but can override this in the linker command file.

  DIGEST "<label>[.BE]" "CRC32"              (start, end)
  DIGEST "<label>[.BE]" "CRC64-ECMA"         (start, end)
  DIGEST "<label>[.BE]" "CRC64-GO-ISO"       (start, end)
  DIGEST "<label>[.BE]" "CRC64-GO-ISO-R"     (start, end)
  DIGEST "<label>[.BE]" "CRC64-WE"           (start, end)
  DIGEST "<label>[.BE]" "CRC64-XZ"           (start, end)
  DIGEST "<label>[.BE]"  POLY (<params>)     (start, end)
  DIGEST TABLE "<label>[.BE]"
  DIGEST SECTION "<section>"

Each command has a label, which gets defined (not include ".BE")

It has been built natively as well as with the following setup
to configure.

  --target=x86_64-pc-linux-gnu
  --target=x86_64-w64-mingw32
  --target=aarch64-linux-gnu
  --target=powerpc64-linux-gnu
  --target=mips-elf
  --enable-targets=all --enable-64-bit-bfd 

A testsuite for all predefined algorithms are added.
The testsuite calculates the CRC for the "123456789"
string which is common.
The expected checksum value is provided.
The check ensures that a table is generated, but does not
check the binary contents of the table.
It is indirectly checked by using the same table for the
algorithm

The "DIGEST POLY" commands are checked by using
the the "CRC32" and "CRC64-ECMA" polynomes and parameters.

There is an online calculator at
http://www.sunshine2k.de/coding/javascript/crc/crc_js.html

There are no testsuites for the DEBUG ON|OFF, TIMESTAMP and
"DIGEST SECTION" commands yet.

The testsuite will fail if "DEBUG ON" is executed due to
verbose output.

The TIMESTAMP output varies with time and is difficult to test.

The DIGEST SECTION command is not tested, because this
need a little extra discussion.
I have not seen any other suitable sections being generated.

Since the information at http://www.sunshine2k.de/ has
been very useful, their license (MIT) is added.

Code examples for the CRC check routines that needs to be in the
user source is added to the documentation with copyright statements.
Should they be there, or is it enough to have the license
in the source code?

The Makefile.in is manually generated since I had a HDD crash
and upgraded to a new disk and installed Ubuntu 22.04.
The autotools are upgraded to 2.71. The build system
did not like this, so I installed 2.69.
This changes a lot more than the autotools-2.69 in Ubuntu 18.04
so I resorted to manual edit of Makefile.in.

Maybe someone should run autotools and generate this automatically
instead of applying the the manual edit.

Added instructions to build ldint.pdf which is not buildable today.

The system has only been tested on a PC == little endian.
I do not have a big endian host, but maybe someone could
test it on such a host.

The way endianess is implemented, it is easy for the user
to supply a workaround by specifying another endianess.



Fifth patchset.

+* The linker script has a new command to insert a timestamp
+  TIMESTAMP
+  inserts the current time (seconds since Epoch) as a 64-bit value
+
+* The linker script syntax has new commands for debugging a linker script
+  DEBUG ON  turns on debugging
+  DEBUG OFF turns off debugging
+
+* The linker script syntax has new commands for handling CRC-32/64 calculations
+  on the '.text' section
+  It uses code from https://www.libcrc.org/
+
+  DIGEST "CRC32"              (start, end)
+  DIGEST "CRC64-ECMA"         (start, end)
+  DIGEST "CRC64-ISO"          (start, end)
+  DIGEST "CRC64-WE"           (start, end)
+  DIGEST POLY (size, polynome)(start, end)
+  DIGEST POLYI(size, polynome)(start, end) (inversion during CRC calculation)
+  DIGEST TABLE
+  DIGEST SECTION "<section>

ran indent on the new files.

The *.d files in the testsuite was edited to 
reduce size and to remove all '(' characters.
The new linker can link using the testsuite/ld-script/*.t
linker files, but they do not pass the 'make check-ld'
test.

Fourth patchset.
Get rid of binaries in testsuite.

Here is the third patchset for introducing CRC64 generation.
This has focused on supporting maintainability of the feature.
In order to do so, CRC32 generation has been introduced to
detect issues when extending the linker with another algoritm
for checking integrity of the image.
This will simplify adding other algorithms like SHA algoritms
in the future.

In addition, the TIMESTAMP command is used to store the current time
in seconds since Epoch is stored in the image.

The main routine for calculating CRCs has been broken down
in subroutines which allow other algorithms.

An algorithm typically needs
<type> *init_<algo>_tab( <type> poly )
<type> calc_<algo>_inv( const unsigned char *input_str, size_t num_bytes );
<type> calc_<algo>    ( const unsigned char *input_str, size_t num_bytes );
void lang_add_<algo>_syndrome(bool invert, bfd_vma poly)
void lang_add_<algo>_table(void)

The common functions are:
* bool get_text_section_contents(void)
  This reads the '.text' section and its contents
  Pointers are stored in the global variables
  asection *text_section
  char     *text_contents
* bool set_crc_checksum(bfd_vma crc, bfd_vma addr, bfd_vma size)
  Stores the CRC at the index addr. The size of the CRC in bytes is specified.
  Storing something larger that 64-bit is not supported here.
* bool symbol_lookup(char *name, bfd_vma *val)
  Gets the value of a symbol into 'val'. Returns false if not found.

To add CRC32 support means adding the following commands
* CRC32 CRC32                    '(' crc_start ',' crc_end ')'
* CRC32 POLY  '[' mustbe_exp ']' '(' crc_start ',' crc_end ')'
* CRC32 POLYI '[' mustbe_exp ']' '(' crc_start ',' crc_end ')'

================
Here is the second patchset for introducing CRC64 generation in the linker
This is mainly looking at indentation and whitespace errors.
The patches applies cleanly without whitespace error
except for the last patch which contains the testsuite.
When the contents of .text is printed out, sometimes
the last byte of a line in the CRC table is a space.
This is reported as a whitespace error.

Supports the following new linker commands:
* CRC64 ECMA                     '(' crc_start ',' crc_end ')'
* CRC64 ISO                      '(' crc_start ',' crc_end ')'
* CRC64 POLY  '[' mustbe_exp ']' '(' crc_start ',' crc_end ')'
* CRC64 POLYI '[' mustbe_exp ']' '(' crc_start ',' crc_end ')'
* CRC64 TABLE

ECMA  == 0x42F0E1EBA9EA3693
ISO   == 0xD800000000000000
POLY  == Allows your own polynome
POLYI == Allows your own polynome, with inversion during calc

The CRC is calculated from crc_start to crc_end (not included)

The "CRC64 <polynome> command
* Allows specifying the polynom (ECMA(default), ISO or your own)
* Allows for inversion in the CRC calculation (CRC64-WE)
* Allows specifying the area that should be checked.
* reserves room for the CRC (8 bytes)
* Declares a symbol ___CRC64___ for the address of the CRC.
* Declares a symbol ___CRC64_START___ for the first address of the checked area
* Declares a symbol ___CRC64_END___ for the first address after the checked area

The symbols names are declared in "checksum.h".
If the names are unsuitable, it is easy to change.

The CRC TABLE command
  This is used to speed up the CRC calculation.
* Creates a 2kB table which speeds up the CRC calculation
* Can insert the 2kB table into the .text section at current location.
* Declares a symbol ___CRC64_TABLE___ if the table is inserted.

Comments on the code:

The process of calculation involves:
* Check if CRC is requested
* Validation of CRC prerequisites
* get .text section
* get .text section contents
* calculate CRC over the area
* insert the CRC in the correct location
====================================

This version also supports the
* DEBUG ON
* DEBUG OFF
turning on/off yydebug
I find it useful for debugging the build, but it can easly be removed.

This patch contains a lot of debug output, that is enabled by
#define DEBUG_CRC 1
This should be removed in the final version.

The ld.texi stuff needs some more work. Not very experienced with that.

Added an entry in NEWS

Added 4 test cases for the different CRC64 polynome commands.
All testcases generate a CRC table.

The code is using the libcrc released under an MIT license found in
* https://www.libcrc.org/
* https://github.com/lammertb/libcrc/tree/v2.0
Author:  Lammert Bies
A license for libcrc is added to the patch.


[PATCH v9 01/11] [gdb/testsuite] Fix gdb.rust/watch.exp on ppc64le
[PATCH v9 02/11] Remove value_in
[PATCH v9 03/11] [gdb/testsuite] Fix gdb.python/py-breakpoint.exp
[PATCH v9 04/11] gdb: add HtabPrinter to gdb-gdb.py.in
[PATCH v9 05/11] Automatic date update in version.in
[PATCH v9 06/11] Memory leak in gas do_repeat
[PATCH v9 07/11] gas s_fill caused internal error in frag_new
[PATCH v9 08/11] Catch overflow in gas s_space
[PATCH v9 09/11] [gdb/testsuite] Add another xfail case in
[PATCH v9 10/11] Fix btrace regression
[PATCH v9 11/11] Fix typo with my email address


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

* [PATCH v9 01/11] [gdb/testsuite] Fix gdb.rust/watch.exp on ppc64le
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
@ 2023-03-02 22:03 ` binutils
  2023-03-02 22:03 ` [PATCH v9 02/11] Remove value_in binutils
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:03 UTC (permalink / raw)
  To: binutils; +Cc: nickc, Tom de Vries

From: Tom de Vries <tdevries@suse.de>

On x86_64-linux, I have:
...
(gdb) watch -location y^M
Hardware watchpoint 2: -location y^M
(gdb) PASS: gdb.rust/watch.exp: watch -location y
...
but on powerpc64le-linux, I run into:
...
(gdb) watch -location y^M
Watchpoint 2: -location y^M
(gdb) FAIL: gdb.rust/watch.exp: watch -location y
...
due to the regexp matching "Hardware watchpoint" but not "Watchpoint":
...
gdb_test "watch -location y" ".*watchpoint .* -location .*"
...

Fix this by making the regexp less restrictive.

Tested on x86_64-linux and powerpc64le-linux.
---
 gdb/testsuite/gdb.rust/watch.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.rust/watch.exp b/gdb/testsuite/gdb.rust/watch.exp
index 83cb41cc1eb..43c88f8a1fc 100644
--- a/gdb/testsuite/gdb.rust/watch.exp
+++ b/gdb/testsuite/gdb.rust/watch.exp
@@ -30,4 +30,4 @@ if {![runto ${srcfile}:$line]} {
 }
 
 # Just setting a watchpoint was enough to trigger the bug.
-gdb_test "watch -location y" ".*watchpoint .* -location .*"
+gdb_test "watch -location y" ".*\[wW\]atchpoint .* -location .*"
-- 
2.34.1


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

* [PATCH v9 02/11] Remove value_in
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
  2023-03-02 22:03 ` [PATCH v9 01/11] [gdb/testsuite] Fix gdb.rust/watch.exp on ppc64le binutils
@ 2023-03-02 22:03 ` binutils
  2023-03-02 22:04 ` [PATCH v9 03/11] [gdb/testsuite] Fix gdb.python/py-breakpoint.exp timeouts binutils
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:03 UTC (permalink / raw)
  To: binutils; +Cc: nickc, Tom Tromey

From: Tom Tromey <tromey@adacore.com>

value_in is unused.  From git log, it seems to have been part of the
Chill language, which was removed from gdb eons ago.  This patch
removes the function.  Tested by rebuilding.
---
 gdb/valarith.c | 23 -----------------------
 gdb/value.h    |  2 --
 2 files changed, 25 deletions(-)

diff --git a/gdb/valarith.c b/gdb/valarith.c
index a6a5f5102a2..070ee63808e 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -2020,26 +2020,3 @@ value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
     rel_index = TARGET_CHAR_BIT - 1 - rel_index;
   return (word >> rel_index) & 1;
 }
-
-int
-value_in (struct value *element, struct value *set)
-{
-  int member;
-  struct type *settype = check_typedef (set->type ());
-  struct type *eltype = check_typedef (element->type ());
-
-  if (eltype->code () == TYPE_CODE_RANGE)
-    eltype = eltype->target_type ();
-  if (settype->code () != TYPE_CODE_SET)
-    error (_("Second argument of 'IN' has wrong type"));
-  if (eltype->code () != TYPE_CODE_INT
-      && eltype->code () != TYPE_CODE_CHAR
-      && eltype->code () != TYPE_CODE_ENUM
-      && eltype->code () != TYPE_CODE_BOOL)
-    error (_("First argument of 'IN' has wrong type"));
-  member = value_bit_index (settype, set->contents ().data (),
-			    value_as_long (element));
-  if (member < 0)
-    error (_("First argument of 'IN' not in range"));
-  return member;
-}
diff --git a/gdb/value.h b/gdb/value.h
index f2a4907ab81..c3eb96bf143 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1270,8 +1270,6 @@ extern struct value *value_bitstring_subscript (struct type *type,
 extern struct value *register_value_being_returned (struct type *valtype,
 						    struct regcache *retbuf);
 
-extern int value_in (struct value *element, struct value *set);
-
 extern int value_bit_index (struct type *type, const gdb_byte *addr,
 			    int index);
 
-- 
2.34.1


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

* [PATCH v9 03/11] [gdb/testsuite] Fix gdb.python/py-breakpoint.exp timeouts
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
  2023-03-02 22:03 ` [PATCH v9 01/11] [gdb/testsuite] Fix gdb.rust/watch.exp on ppc64le binutils
  2023-03-02 22:03 ` [PATCH v9 02/11] Remove value_in binutils
@ 2023-03-02 22:04 ` binutils
  2023-03-02 22:04 ` [PATCH v9 04/11] gdb: add HtabPrinter to gdb-gdb.py.in binutils
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:04 UTC (permalink / raw)
  To: binutils; +Cc: nickc, Tom de Vries

From: Tom de Vries <tdevries@suse.de>

On powerpc64le-linux, I run into two timeouts:
...
FAIL: gdb.python/py-breakpoint.exp: test_watchpoints: \
  Test watchpoint write (timeout)
FAIL: gdb.python/py-breakpoint.exp: test_bkpt_internal: \
  Test watchpoint write (timeout)
...

In this case, hw watchpoints are not supported, and using sw watchpoints
is slow.

Most of the time is spent in handling a try-catch, which triggers a malloc.  I
think this bit is more relevant for the "catch throw" part of the test-case,
so fix the timeouts by setting the watchpoints after the try-catch.

Tested on x86_64-linux and powerpc64le-linux.
---
 gdb/testsuite/gdb.python/py-breakpoint.c   | 2 ++
 gdb/testsuite/gdb.python/py-breakpoint.exp | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-breakpoint.c b/gdb/testsuite/gdb.python/py-breakpoint.c
index 0f791da9c27..1fb341660e9 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.c
+++ b/gdb/testsuite/gdb.python/py-breakpoint.c
@@ -60,6 +60,8 @@ int main (int argc, char *argv[])
       /* Nothing.  */
     }
 
+  i = -1; /* Past throw-catch.  */
+
   for (i = 0; i < 10; i++)
     {
       result += multiply (foo);  /* Break at multiply. */
diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index 9535040e3a2..ab81b7ade85 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -36,6 +36,8 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${options}]
     return -1
 }
 
+set past_throw_catch_line [gdb_get_line_number "Past throw-catch."]
+
 proc_with_prefix test_bkpt_basic { } {
     global srcfile testfile hex decimal
 
@@ -293,7 +295,7 @@ proc_with_prefix test_watchpoints { } {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
 
-    if {![runto_main]} {
+    if {![runto $srcfile:$::past_throw_catch_line]} {
 	return 0
     }
 
@@ -316,7 +318,7 @@ proc_with_prefix test_bkpt_internal { } {
     if {!$allow_hw_watchpoint_tests_p} {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
-    if {![runto_main]} {
+    if {![runto $srcfile:$::past_throw_catch_line]} {
 	return 0
     }
     delete_breakpoints
-- 
2.34.1


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

* [PATCH v9 04/11] gdb: add HtabPrinter to gdb-gdb.py.in
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
                   ` (2 preceding siblings ...)
  2023-03-02 22:04 ` [PATCH v9 03/11] [gdb/testsuite] Fix gdb.python/py-breakpoint.exp timeouts binutils
@ 2023-03-02 22:04 ` binutils
  2023-03-02 22:04 ` [PATCH v9 05/11] Automatic date update in version.in binutils
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:04 UTC (permalink / raw)
  To: binutils; +Cc: nickc, Simon Marchi, Tom Tromey

From: Simon Marchi <simon.marchi@efficios.com>

When debugging GDB, I find it a bit tedious to inspect htab_t objects.
It is possible to find the entries by poking at the fields, but it's
annoying to do each time.  I think a pretty printer would help.  Add a
basic one to gdb-gdb.py.

The pretty printer advertises itself as "array-like", and the result
looks like:

    (top-gdb) p bfcache
    $3 = htab_t with 3 elements = {0x6210003252a0, 0x62100032caa0, 0x62100033baa0}

The htab_t itself doesn't know about the type of pointed objects.  But
it's easy enough to cast the addresses to the right type to use them:

    (top-gdb) print *((btrace_frame_cache *) 0x6210003252a0)
    $6 = {tp = 0x61700002ed80, frame = 0x6210003251e0, bfun = 0x62000000b390}

Change-Id: Ia692e3555fe7a117b7ec087840246b1260a704c6
Reviewed-By: Tom Tromey <tom@tromey.com>
---
 gdb/gdb-gdb.py.in                       | 31 +++++++++++++++++++++++++
 gdb/testsuite/gdb.gdb/python-helper.exp |  3 +++
 2 files changed, 34 insertions(+)

diff --git a/gdb/gdb-gdb.py.in b/gdb/gdb-gdb.py.in
index 95b7d84966f..56d063cd506 100644
--- a/gdb/gdb-gdb.py.in
+++ b/gdb/gdb-gdb.py.in
@@ -369,6 +369,35 @@ class IntrusiveListPrinter:
         return self._children_generator()
 
 
+class HtabPrinter:
+    """Pretty-printer for htab_t hash tables."""
+
+    def __init__(self, val):
+        self._val = val
+
+    def display_hint(self):
+        return "array"
+
+    def to_string(self):
+        n = int(self._val["n_elements"]) - int(self._val["n_deleted"])
+        return "htab_t with {} elements".format(n)
+
+    def children(self):
+        size = int(self._val["size"])
+        entries = self._val["entries"]
+
+        child_i = 0
+        for entries_i in range(size):
+            entry = entries[entries_i]
+            # 0 (NULL pointer) means there's nothing, 1 (HTAB_DELETED_ENTRY)
+            # means there was something, but is now deleted.
+            if int(entry) in (0, 1):
+                continue
+
+            yield (str(child_i), entry)
+            child_i += 1
+
+
 def type_lookup_function(val):
     """A routine that returns the correct pretty printer for VAL
     if appropriate.  Returns None otherwise.
@@ -383,6 +412,8 @@ def type_lookup_function(val):
         return CoreAddrPrettyPrinter(val)
     elif tag is not None and tag.startswith("intrusive_list<"):
         return IntrusiveListPrinter(val)
+    elif name == "htab_t":
+        return HtabPrinter(val)
     return None
 
 
diff --git a/gdb/testsuite/gdb.gdb/python-helper.exp b/gdb/testsuite/gdb.gdb/python-helper.exp
index f1e95fbe5ee..16b419984cf 100644
--- a/gdb/testsuite/gdb.gdb/python-helper.exp
+++ b/gdb/testsuite/gdb.gdb/python-helper.exp
@@ -208,6 +208,9 @@ proc test_python_helper {} {
 		    " cplus_stuff = $hex}"]
     gdb_test -prompt $outer_prompt_re "print *type->main_type" $answer
 
+    # Test the htab_t pretty-printer.
+    gdb_test -prompt $outer_prompt_re "print all_bfds" "htab_t with ${::decimal} elements = \\{${::hex}.*\\}"
+
     return 0
 }
 
-- 
2.34.1


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

* [PATCH v9 05/11] Automatic date update in version.in
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
                   ` (3 preceding siblings ...)
  2023-03-02 22:04 ` [PATCH v9 04/11] gdb: add HtabPrinter to gdb-gdb.py.in binutils
@ 2023-03-02 22:04 ` binutils
  2023-03-02 22:04 ` [PATCH v9 06/11] Memory leak in gas do_repeat binutils
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:04 UTC (permalink / raw)
  To: binutils; +Cc: nickc, GDB Administrator

From: GDB Administrator <gdbadmin@sourceware.org>

---
 bfd/version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bfd/version.h b/bfd/version.h
index 493a1ef6e1a..34e031adef5 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -16,7 +16,7 @@
 
    In releases, the date is not included in either version strings or
    sonames.  */
-#define BFD_VERSION_DATE 20230228
+#define BFD_VERSION_DATE 20230301
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
 #define REPORT_BUGS_TO @report_bugs_to@
-- 
2.34.1


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

* [PATCH v9 06/11] Memory leak in gas do_repeat
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
                   ` (4 preceding siblings ...)
  2023-03-02 22:04 ` [PATCH v9 05/11] Automatic date update in version.in binutils
@ 2023-03-02 22:04 ` binutils
  2023-03-02 22:04 ` [PATCH v9 07/11] gas s_fill caused internal error in frag_new binutils
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:04 UTC (permalink / raw)
  To: binutils; +Cc: nickc, Alan Modra

From: Alan Modra <amodra@gmail.com>

	* read.c (do_repeat): Free sb on error path.
---
 gas/read.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gas/read.c b/gas/read.c
index f1099cba1a3..d43584be28c 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -3029,6 +3029,7 @@ do_repeat (size_t count, const char *start, const char *end,
   if (!buffer_and_nest (start, end, &one, get_non_macro_line_sb))
     {
       as_bad (_("%s without %s"), start, end);
+      sb_kill (&one);
       return;
     }
 
-- 
2.34.1


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

* [PATCH v9 07/11] gas s_fill caused internal error in frag_new
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
                   ` (5 preceding siblings ...)
  2023-03-02 22:04 ` [PATCH v9 06/11] Memory leak in gas do_repeat binutils
@ 2023-03-02 22:04 ` binutils
  2023-03-02 22:04 ` [PATCH v9 08/11] Catch overflow in gas s_space binutils
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:04 UTC (permalink / raw)
  To: binutils; +Cc: nickc, Alan Modra

From: Alan Modra <amodra@gmail.com>

Fix an internal error after "non-constant fill count for absolute
section".

	* read.c (s_fill): Don't create frags after errors.
---
 gas/read.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/gas/read.c b/gas/read.c
index d43584be28c..5d83d35e0aa 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -2201,22 +2201,32 @@ s_fill (int ignore ATTRIBUTE_UNUSED)
 	as_warn (_("repeat < 0; .fill ignored"));
       size = 0;
     }
-
-  if (size && !need_pass_2)
+  else if (size && !need_pass_2)
     {
-      if (now_seg == absolute_section)
+      if (now_seg == absolute_section && rep_exp.X_op != O_constant)
 	{
-	  if (rep_exp.X_op != O_constant)
-	    as_bad (_("non-constant fill count for absolute section"));
-	  else if (fill && rep_exp.X_add_number != 0)
-	    as_bad (_("attempt to fill absolute section with non-zero value"));
-	  abs_section_offset += rep_exp.X_add_number * size;
+	  as_bad (_("non-constant fill count for absolute section"));
+	  size = 0;
+	}
+      else if (now_seg == absolute_section && fill && rep_exp.X_add_number != 0)
+	{
+	  as_bad (_("attempt to fill absolute section with non-zero value"));
+	  size = 0;
 	}
       else if (fill
 	       && (rep_exp.X_op != O_constant || rep_exp.X_add_number != 0)
 	       && in_bss ())
-	as_bad (_("attempt to fill section `%s' with non-zero value"),
-		segment_name (now_seg));
+	{
+	  as_bad (_("attempt to fill section `%s' with non-zero value"),
+		  segment_name (now_seg));
+	  size = 0;
+	}
+    }
+
+  if (size && !need_pass_2)
+    {
+      if (now_seg == absolute_section)
+	abs_section_offset += rep_exp.X_add_number * size;
 
       if (rep_exp.X_op == O_constant)
 	{
-- 
2.34.1


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

* [PATCH v9 08/11] Catch overflow in gas s_space
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
                   ` (6 preceding siblings ...)
  2023-03-02 22:04 ` [PATCH v9 07/11] gas s_fill caused internal error in frag_new binutils
@ 2023-03-02 22:04 ` binutils
  2023-03-02 22:04 ` [PATCH v9 09/11] [gdb/testsuite] Add another xfail case in gdb.python/py-record-btrace.exp binutils
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:04 UTC (permalink / raw)
  To: binutils; +Cc: nickc, Alan Modra

From: Alan Modra <amodra@gmail.com>

Also fix an error introduced in 1998 in reporting a zero count for
negative counts.

      * read.c (s_space): Use unsigned multiply, and catch overflow.
      Correct order of tests for invalid repeat counts.  Ensure
      ignored directives don't affect mri_pending_align.
---
 gas/read.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/gas/read.c b/gas/read.c
index 5d83d35e0aa..cff44623541 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -3328,27 +3328,37 @@ s_space (int mult)
 
       if (exp.X_op == O_constant)
 	{
-	  offsetT repeat;
+	  addressT repeat = exp.X_add_number;
+	  addressT total;
 
-	  repeat = exp.X_add_number;
-	  if (mult)
-	    repeat *= mult;
-	  bytes = repeat;
-	  if (repeat <= 0)
+	  bytes = 0;
+	  if ((offsetT) repeat < 0)
+	    {
+	      as_warn (_(".space repeat count is negative, ignored"));
+	      goto getout;
+	    }
+	  if (repeat == 0)
 	    {
 	      if (!flag_mri)
 		as_warn (_(".space repeat count is zero, ignored"));
-	      else if (repeat < 0)
-		as_warn (_(".space repeat count is negative, ignored"));
 	      goto getout;
 	    }
+	  if ((unsigned int) mult <= 1)
+	    total = repeat;
+	  else if (gas_mul_overflow (repeat, mult, &total)
+		   || (offsetT) total < 0)
+	    {
+	      as_warn (_(".space repeat count overflow, ignored"));
+	      goto getout;
+	    }
+	  bytes = total;
 
 	  /* If we are in the absolute section, just bump the offset.  */
 	  if (now_seg == absolute_section)
 	    {
 	      if (val.X_op != O_constant || val.X_add_number != 0)
 		as_warn (_("ignoring fill value in absolute section"));
-	      abs_section_offset += repeat;
+	      abs_section_offset += total;
 	      goto getout;
 	    }
 
@@ -3358,13 +3368,13 @@ s_space (int mult)
 	  if (mri_common_symbol != NULL)
 	    {
 	      S_SET_VALUE (mri_common_symbol,
-			   S_GET_VALUE (mri_common_symbol) + repeat);
+			   S_GET_VALUE (mri_common_symbol) + total);
 	      goto getout;
 	    }
 
 	  if (!need_pass_2)
 	    p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0,
-			  (offsetT) repeat, (char *) 0);
+			  (offsetT) total, (char *) 0);
 	}
       else
 	{
-- 
2.34.1


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

* [PATCH v9 09/11] [gdb/testsuite] Add another xfail case in gdb.python/py-record-btrace.exp
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
                   ` (7 preceding siblings ...)
  2023-03-02 22:04 ` [PATCH v9 08/11] Catch overflow in gas s_space binutils
@ 2023-03-02 22:04 ` binutils
  2023-03-02 22:04 ` [PATCH v9 10/11] Fix btrace regression binutils
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:04 UTC (permalink / raw)
  To: binutils; +Cc: nickc, Tom de Vries, Markus T . Metzger

From: Tom de Vries <tdevries@suse.de>

I ran into:
...
(gdb) PASS: gdb.python/py-record-btrace.exp: function call: \
  python print(c.prev)
python print(c == c.next.prev)^M
Traceback (most recent call last):^M
  File "<string>", line 1, in <module>^M
AttributeError: 'NoneType' object has no attribute 'prev'^M
Error while executing Python code.^M
(gdb) FAIL: gdb.python/py-record-btrace.exp: function call: \
  python print(c == c.next.prev)
...
due to having only 4 insn instead of 100:
...
python print(len(insn))^M
4^M
...

This could be caused by the same hw bug as we already have an xfail for, so
expand the xfail matching.

Tested on x86_64-linux.

PR testsuite/30185
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30185

Approved-By: Markus T. Metzger <markus.t.metzger@intel.com>
---
 gdb/testsuite/gdb.python/py-record-btrace.exp | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp
index 703db0ce8e1..bd397d3c974 100644
--- a/gdb/testsuite/gdb.python/py-record-btrace.exp
+++ b/gdb/testsuite/gdb.python/py-record-btrace.exp
@@ -101,6 +101,25 @@ with_test_prefix "prepare record" {
 	return
     }
 
+    # Also handle the case that we're running into the hw bug without
+    # triggering a decode error.
+    gdb_test_multiple "python print(len(insn))" "" {
+	-re -wrap "100" {
+	    pass $gdb_test_name
+	}
+	-re -wrap "" {
+	    if { $have_xfail } {
+		xfail $gdb_test_name
+		set got_xfail 1
+	    } else {
+		fail $gdb_test_name
+	    }
+	}
+    }
+    if { $got_xfail } {
+	return
+    }
+
     gdb_test_no_output "python call = r.function_call_history"
     gdb_test_no_output "python i = insn\[0\]"
     gdb_test_no_output "python c = call\[0\]"
@@ -138,7 +157,6 @@ with_test_prefix "function call" {
 }
 
 with_test_prefix "list" {
-    gdb_test "python print(len(insn))" "100"
     gdb_test "python print(len(insn\[23:65\]))" "42"
     gdb_test "python print(insn\[17:\]\[2\].number)" "20"
     gdb_test "python print(i in insn)" "True"
-- 
2.34.1


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

* [PATCH v9 10/11] Fix btrace regression
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
                   ` (8 preceding siblings ...)
  2023-03-02 22:04 ` [PATCH v9 09/11] [gdb/testsuite] Add another xfail case in gdb.python/py-record-btrace.exp binutils
@ 2023-03-02 22:04 ` binutils
  2023-03-02 22:04 ` [PATCH v9 11/11] Fix typo with my email address binutils
  2023-03-02 23:09 ` [PATCH v9 0/11 Add support for CRC64 generation in linker Ulf Samuelsson
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:04 UTC (permalink / raw)
  To: binutils; +Cc: nickc, Tom Tromey, Bruno Larsen

From: Tom Tromey <tom@tromey.com>

Tom de Vries pointed out that my earlier patch:

    commit 873a185be258ad2552b9579005852815b4da5baf
    Date:   Fri Dec 16 07:56:57 2022 -0700

	Don't use struct buffer in handle_qxfer_btrace

regressed gdb.btrace/reconnect.exp.  I didn't notice this because I
did not have libipt installed.

This patch fixes the bug.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30169
Tested-By: Bruno Larsen <blarsen@redhat.com>
---
 gdbserver/linux-low.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index dec1944d45f..0ca3bb1cd6a 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -6781,7 +6781,7 @@ linux_low_encode_raw (std::string *buffer, const gdb_byte *data,
       elem[0] = tohex ((*data >> 4) & 0xf);
       elem[1] = tohex (*data++ & 0xf);
 
-      buffer->append (elem);
+      buffer->append (elem, 2);
     }
 
   *buffer += "</raw>\n";
-- 
2.34.1


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

* [PATCH v9 11/11] Fix typo with my email address
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
                   ` (9 preceding siblings ...)
  2023-03-02 22:04 ` [PATCH v9 10/11] Fix btrace regression binutils
@ 2023-03-02 22:04 ` binutils
  2023-03-02 23:09 ` [PATCH v9 0/11 Add support for CRC64 generation in linker Ulf Samuelsson
  11 siblings, 0 replies; 13+ messages in thread
From: binutils @ 2023-03-02 22:04 UTC (permalink / raw)
  To: binutils; +Cc: nickc

From: Nick Clifton <nickc@redhat.com>

---
 ld/ld.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ld/ld.texi b/ld/ld.texi
index 7802f0661b0..3367075cae8 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -85,7 +85,7 @@ section entitled ``GNU Free Documentation License''.
 @tex
 {\parskip=0pt
 \hfill Red Hat Inc\par
-\hfill nickc\@credhat.com, doc\@redhat.com\par
+\hfill nickc\@redhat.com, doc\@redhat.com\par
 \hfill {\it The GNU linker}\par
 \hfill Edited by Jeffrey Osier (jeffrey\@cygnus.com)\par
 }
-- 
2.34.1


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

* Re: [PATCH v9 0/11 Add support for CRC64 generation in linker
  2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
                   ` (10 preceding siblings ...)
  2023-03-02 22:04 ` [PATCH v9 11/11] Fix typo with my email address binutils
@ 2023-03-02 23:09 ` Ulf Samuelsson
  11 siblings, 0 replies; 13+ messages in thread
From: Ulf Samuelsson @ 2023-03-02 23:09 UTC (permalink / raw)
  To: binutils; +Cc: nickc

Please ignore this.
I sent the clean master branch, instead of the real branch.

I really need to create a CHECKLIST for pushing to the list

Sorry,

Best Regards
Ulf Samuelsson

On 2023-03-02 23:03, Ulf Samuelsson via Binutils wrote:
> Patchset IX
> Endian:
> Default small endian.
> Override with switches: -BE, -LE
> Override in label using [#BE] and [#LE]
>
>    DIGEST "<label>[#BE|#LE]" "CRC32"              (start, end)
>    DIGEST "<label>[#BE|#LE]" "CRC64-ECMA"         (start, end)
>    DIGEST "<label>[#BE|#LE]" "CRC64-GO-ISO"       (start, end)
>    DIGEST "<label>[#BE|#LE]" "CRC64-GO-ISO-R"     (start, end)
>    DIGEST "<label>[#BE|#LE]" "CRC64-WE"           (start, end)
>    DIGEST "<label>[#BE|#LE]" "CRC64-XZ"           (start, end)
>    DIGEST "<label>[#BE|#LE]"  POLY (<params>)     (start, end)
>    DIGEST TABLE "<label>[#BE|#LE]"
>    DIGEST SECTION "<section>"
>
> Improve error messages. Some warnings are now errors.
> Handle reported errors.
> Keep DIGEST SECTION "name", but the whole feature should be deleted.
>
> Patchset VIII
> Memory in testsuite reduced to 16kB ROM and 4 kB RAM
> All situated in the first 64 KB.
>
> Patchset VII
>
> Rebased against master
> Fixed whitespace errors
> Run indent on CRC files
> Moved license to ld directory and renamed to COPYING.<website>
> Added comments to COPYING.www.sunshine2k.de explaining what it is.
>
> Patchset six
> Commands changes so you always get little endian
> but can override this in the linker command file.
>
>    DIGEST "<label>[.BE]" "CRC32"              (start, end)
>    DIGEST "<label>[.BE]" "CRC64-ECMA"         (start, end)
>    DIGEST "<label>[.BE]" "CRC64-GO-ISO"       (start, end)
>    DIGEST "<label>[.BE]" "CRC64-GO-ISO-R"     (start, end)
>    DIGEST "<label>[.BE]" "CRC64-WE"           (start, end)
>    DIGEST "<label>[.BE]" "CRC64-XZ"           (start, end)
>    DIGEST "<label>[.BE]"  POLY (<params>)     (start, end)
>    DIGEST TABLE "<label>[.BE]"
>    DIGEST SECTION "<section>"
>
> Each command has a label, which gets defined (not include ".BE")
>
> It has been built natively as well as with the following setup
> to configure.
>
>    --target=x86_64-pc-linux-gnu
>    --target=x86_64-w64-mingw32
>    --target=aarch64-linux-gnu
>    --target=powerpc64-linux-gnu
>    --target=mips-elf
>    --enable-targets=all --enable-64-bit-bfd
>
> A testsuite for all predefined algorithms are added.
> The testsuite calculates the CRC for the "123456789"
> string which is common.
> The expected checksum value is provided.
> The check ensures that a table is generated, but does not
> check the binary contents of the table.
> It is indirectly checked by using the same table for the
> algorithm
>
> The "DIGEST POLY" commands are checked by using
> the the "CRC32" and "CRC64-ECMA" polynomes and parameters.
>
> There is an online calculator at
> http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
>
> There are no testsuites for the DEBUG ON|OFF, TIMESTAMP and
> "DIGEST SECTION" commands yet.
>
> The testsuite will fail if "DEBUG ON" is executed due to
> verbose output.
>
> The TIMESTAMP output varies with time and is difficult to test.
>
> The DIGEST SECTION command is not tested, because this
> need a little extra discussion.
> I have not seen any other suitable sections being generated.
>
> Since the information at http://www.sunshine2k.de/ has
> been very useful, their license (MIT) is added.
>
> Code examples for the CRC check routines that needs to be in the
> user source is added to the documentation with copyright statements.
> Should they be there, or is it enough to have the license
> in the source code?
>
> The Makefile.in is manually generated since I had a HDD crash
> and upgraded to a new disk and installed Ubuntu 22.04.
> The autotools are upgraded to 2.71. The build system
> did not like this, so I installed 2.69.
> This changes a lot more than the autotools-2.69 in Ubuntu 18.04
> so I resorted to manual edit of Makefile.in.
>
> Maybe someone should run autotools and generate this automatically
> instead of applying the the manual edit.
>
> Added instructions to build ldint.pdf which is not buildable today.
>
> The system has only been tested on a PC == little endian.
> I do not have a big endian host, but maybe someone could
> test it on such a host.
>
> The way endianess is implemented, it is easy for the user
> to supply a workaround by specifying another endianess.
>
>
>
> Fifth patchset.
>
> +* The linker script has a new command to insert a timestamp
> +  TIMESTAMP
> +  inserts the current time (seconds since Epoch) as a 64-bit value
> +
> +* The linker script syntax has new commands for debugging a linker script
> +  DEBUG ON  turns on debugging
> +  DEBUG OFF turns off debugging
> +
> +* The linker script syntax has new commands for handling CRC-32/64 calculations
> +  on the '.text' section
> +  It uses code from https://www.libcrc.org/
> +
> +  DIGEST "CRC32"              (start, end)
> +  DIGEST "CRC64-ECMA"         (start, end)
> +  DIGEST "CRC64-ISO"          (start, end)
> +  DIGEST "CRC64-WE"           (start, end)
> +  DIGEST POLY (size, polynome)(start, end)
> +  DIGEST POLYI(size, polynome)(start, end) (inversion during CRC calculation)
> +  DIGEST TABLE
> +  DIGEST SECTION "<section>
>
> ran indent on the new files.
>
> The *.d files in the testsuite was edited to
> reduce size and to remove all '(' characters.
> The new linker can link using the testsuite/ld-script/*.t
> linker files, but they do not pass the 'make check-ld'
> test.
>
> Fourth patchset.
> Get rid of binaries in testsuite.
>
> Here is the third patchset for introducing CRC64 generation.
> This has focused on supporting maintainability of the feature.
> In order to do so, CRC32 generation has been introduced to
> detect issues when extending the linker with another algoritm
> for checking integrity of the image.
> This will simplify adding other algorithms like SHA algoritms
> in the future.
>
> In addition, the TIMESTAMP command is used to store the current time
> in seconds since Epoch is stored in the image.
>
> The main routine for calculating CRCs has been broken down
> in subroutines which allow other algorithms.
>
> An algorithm typically needs
> <type> *init_<algo>_tab( <type> poly )
> <type> calc_<algo>_inv( const unsigned char *input_str, size_t num_bytes );
> <type> calc_<algo>    ( const unsigned char *input_str, size_t num_bytes );
> void lang_add_<algo>_syndrome(bool invert, bfd_vma poly)
> void lang_add_<algo>_table(void)
>
> The common functions are:
> * bool get_text_section_contents(void)
>    This reads the '.text' section and its contents
>    Pointers are stored in the global variables
>    asection *text_section
>    char     *text_contents
> * bool set_crc_checksum(bfd_vma crc, bfd_vma addr, bfd_vma size)
>    Stores the CRC at the index addr. The size of the CRC in bytes is specified.
>    Storing something larger that 64-bit is not supported here.
> * bool symbol_lookup(char *name, bfd_vma *val)
>    Gets the value of a symbol into 'val'. Returns false if not found.
>
> To add CRC32 support means adding the following commands
> * CRC32 CRC32                    '(' crc_start ',' crc_end ')'
> * CRC32 POLY  '[' mustbe_exp ']' '(' crc_start ',' crc_end ')'
> * CRC32 POLYI '[' mustbe_exp ']' '(' crc_start ',' crc_end ')'
>
> ================
> Here is the second patchset for introducing CRC64 generation in the linker
> This is mainly looking at indentation and whitespace errors.
> The patches applies cleanly without whitespace error
> except for the last patch which contains the testsuite.
> When the contents of .text is printed out, sometimes
> the last byte of a line in the CRC table is a space.
> This is reported as a whitespace error.
>
> Supports the following new linker commands:
> * CRC64 ECMA                     '(' crc_start ',' crc_end ')'
> * CRC64 ISO                      '(' crc_start ',' crc_end ')'
> * CRC64 POLY  '[' mustbe_exp ']' '(' crc_start ',' crc_end ')'
> * CRC64 POLYI '[' mustbe_exp ']' '(' crc_start ',' crc_end ')'
> * CRC64 TABLE
>
> ECMA  == 0x42F0E1EBA9EA3693
> ISO   == 0xD800000000000000
> POLY  == Allows your own polynome
> POLYI == Allows your own polynome, with inversion during calc
>
> The CRC is calculated from crc_start to crc_end (not included)
>
> The "CRC64 <polynome> command
> * Allows specifying the polynom (ECMA(default), ISO or your own)
> * Allows for inversion in the CRC calculation (CRC64-WE)
> * Allows specifying the area that should be checked.
> * reserves room for the CRC (8 bytes)
> * Declares a symbol ___CRC64___ for the address of the CRC.
> * Declares a symbol ___CRC64_START___ for the first address of the checked area
> * Declares a symbol ___CRC64_END___ for the first address after the checked area
>
> The symbols names are declared in "checksum.h".
> If the names are unsuitable, it is easy to change.
>
> The CRC TABLE command
>    This is used to speed up the CRC calculation.
> * Creates a 2kB table which speeds up the CRC calculation
> * Can insert the 2kB table into the .text section at current location.
> * Declares a symbol ___CRC64_TABLE___ if the table is inserted.
>
> Comments on the code:
>
> The process of calculation involves:
> * Check if CRC is requested
> * Validation of CRC prerequisites
> * get .text section
> * get .text section contents
> * calculate CRC over the area
> * insert the CRC in the correct location
> ====================================
>
> This version also supports the
> * DEBUG ON
> * DEBUG OFF
> turning on/off yydebug
> I find it useful for debugging the build, but it can easly be removed.
>
> This patch contains a lot of debug output, that is enabled by
> #define DEBUG_CRC 1
> This should be removed in the final version.
>
> The ld.texi stuff needs some more work. Not very experienced with that.
>
> Added an entry in NEWS
>
> Added 4 test cases for the different CRC64 polynome commands.
> All testcases generate a CRC table.
>
> The code is using the libcrc released under an MIT license found in
> * https://www.libcrc.org/
> * https://github.com/lammertb/libcrc/tree/v2.0
> Author:  Lammert Bies
> A license for libcrc is added to the patch.
>
>
> [PATCH v9 01/11] [gdb/testsuite] Fix gdb.rust/watch.exp on ppc64le
> [PATCH v9 02/11] Remove value_in
> [PATCH v9 03/11] [gdb/testsuite] Fix gdb.python/py-breakpoint.exp
> [PATCH v9 04/11] gdb: add HtabPrinter to gdb-gdb.py.in
> [PATCH v9 05/11] Automatic date update in version.in
> [PATCH v9 06/11] Memory leak in gas do_repeat
> [PATCH v9 07/11] gas s_fill caused internal error in frag_new
> [PATCH v9 08/11] Catch overflow in gas s_space
> [PATCH v9 09/11] [gdb/testsuite] Add another xfail case in
> [PATCH v9 10/11] Fix btrace regression
> [PATCH v9 11/11] Fix typo with my email address
>

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

end of thread, other threads:[~2023-03-02 23:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02 22:03 [PATCH v9 0/11 Add support for CRC64 generation in linker binutils
2023-03-02 22:03 ` [PATCH v9 01/11] [gdb/testsuite] Fix gdb.rust/watch.exp on ppc64le binutils
2023-03-02 22:03 ` [PATCH v9 02/11] Remove value_in binutils
2023-03-02 22:04 ` [PATCH v9 03/11] [gdb/testsuite] Fix gdb.python/py-breakpoint.exp timeouts binutils
2023-03-02 22:04 ` [PATCH v9 04/11] gdb: add HtabPrinter to gdb-gdb.py.in binutils
2023-03-02 22:04 ` [PATCH v9 05/11] Automatic date update in version.in binutils
2023-03-02 22:04 ` [PATCH v9 06/11] Memory leak in gas do_repeat binutils
2023-03-02 22:04 ` [PATCH v9 07/11] gas s_fill caused internal error in frag_new binutils
2023-03-02 22:04 ` [PATCH v9 08/11] Catch overflow in gas s_space binutils
2023-03-02 22:04 ` [PATCH v9 09/11] [gdb/testsuite] Add another xfail case in gdb.python/py-record-btrace.exp binutils
2023-03-02 22:04 ` [PATCH v9 10/11] Fix btrace regression binutils
2023-03-02 22:04 ` [PATCH v9 11/11] Fix typo with my email address binutils
2023-03-02 23:09 ` [PATCH v9 0/11 Add support for CRC64 generation in linker Ulf Samuelsson

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