Skip to content

Commit 5e9091d

Browse files
committed
gold: Use char16_t, char32_t instead of uint16_t, uint32_t as character types
The std::basic_string template type is only specified for instantiations using character types. Newer (LLVM) libc++ implementations no longer allow non-character integer types to be used. gold/ * output.cc: Include <uchar.h>. (Output_section::add_merge_input_section): Use char16_t and char32_t for 2- and 4-byte entry size, respectively. * stringpool.cc: Include <uchar.h>. (Stringpool_template): Explicitly instantiate for char16_t, char32_t instead of uint16_t, uint32_t. * merge.cc (Output_merge_string): Likewise.
1 parent 33a0b29 commit 5e9091d

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

gold/ChangeLog

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2023-09-05 Roland McGrath <[email protected]>
2+
3+
The std::basic_string template type is only specified for
4+
instantiations using character types. Newer (LLVM) libc++
5+
implementations no longer allow non-character integer types
6+
to be used.
7+
* output.cc: Include <uchar.h>.
8+
(Output_section::add_merge_input_section): Use char16_t and
9+
char32_t for 2- and 4-byte entry size, respectively.
10+
* stringpool.cc: Include <uchar.h>.
11+
(Stringpool_template): Explicitly instantiate for char16_t,
12+
char32_t instead of uint16_t, uint32_t.
13+
* merge.cc (Output_merge_string): Likewise.
14+
115
2023-07-03 Nick Clifton <[email protected]>
216

317
* po/gold.pot: Regenerate.

gold/merge.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,10 +665,10 @@ template
665665
class Output_merge_string<char>;
666666

667667
template
668-
class Output_merge_string<uint16_t>;
668+
class Output_merge_string<char16_t>;
669669

670670
template
671-
class Output_merge_string<uint32_t>;
671+
class Output_merge_string<char32_t>;
672672

673673
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
674674
template

gold/output.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <unistd.h>
3030
#include <sys/stat.h>
3131
#include <algorithm>
32+
#include <uchar.h>
3233

3334
#ifdef HAVE_SYS_MMAN_H
3435
#include <sys/mman.h>
@@ -2706,10 +2707,10 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int shndx,
27062707
pomb = new Output_merge_string<char>(addralign);
27072708
break;
27082709
case 2:
2709-
pomb = new Output_merge_string<uint16_t>(addralign);
2710+
pomb = new Output_merge_string<char16_t>(addralign);
27102711
break;
27112712
case 4:
2712-
pomb = new Output_merge_string<uint32_t>(addralign);
2713+
pomb = new Output_merge_string<char32_t>(addralign);
27132714
break;
27142715
default:
27152716
return false;

gold/stringpool.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <cstring>
2626
#include <algorithm>
2727
#include <vector>
28+
#include <uchar.h>
2829

2930
#include "output.h"
3031
#include "parameters.h"
@@ -527,9 +528,9 @@ template
527528
class Stringpool_template<char>;
528529

529530
template
530-
class Stringpool_template<uint16_t>;
531+
class Stringpool_template<char16_t>;
531532

532533
template
533-
class Stringpool_template<uint32_t>;
534+
class Stringpool_template<char32_t>;
534535

535536
} // End namespace gold.

0 commit comments

Comments
 (0)