aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2021-03-18 12:37:52 +0000
committerNick Alcock <nick.alcock@oracle.com>2021-03-18 12:40:41 +0000
commit69a284867c7c92960653cbeab6f79cd815f1342f (patch)
treeb48c8b256ea735b8fe62da5019c550bc1357667b /ld
parente4c78f303df55b3dfc5746c8d1817cc0df1b76c3 (diff)
downloadfsf-binutils-gdb-69a284867c7c92960653cbeab6f79cd815f1342f.zip
fsf-binutils-gdb-69a284867c7c92960653cbeab6f79cd815f1342f.tar.gz
fsf-binutils-gdb-69a284867c7c92960653cbeab6f79cd815f1342f.tar.bz2
libctf: support encodings for enums
The previous commit started to error-check the lookup of ctf_type_encoding for the underlying type that is internally done when carrying out a ctf_type_encoding on a slice. Unfortunately, enums have no encoding, so this has historically been returning an error (which is ignored) and then populating the cte_format with uninitialized data. Now the error is not ignored, this is returning an error, which breaks linking of CTF containing bitfields of enumerated type. CTF format v3 does not record the actual underlying type of a enum, but we can mock up something that is not *too* wrong, and that is at any rate better than uninitialized data. ld/ChangeLog 2021-03-18 Nick Alcock <nick.alcock@oracle.com> * testsuite/ld-ctf/slice.c: Check slices of enums too. * testsuite/ld-ctf/slice.d: Results adjusted. libctf/ChangeLog 2021-03-18 Nick Alcock <nick.alcock@oracle.com> * ctf-types.c (ctf_type_encoding): Support, after a fashion, for enums. * ctf-dump.c (ctf_dump_format_type): Do not report enums' degenerate encoding.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/testsuite/ld-ctf/slice.c3
-rw-r--r--ld/testsuite/ld-ctf/slice.d4
3 files changed, 10 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 7cc917a..265f0fb 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-18 Nick Alcock <nick.alcock@oracle.com>
+
+ * testsuite/ld-ctf/slice.c: Check slices of enums too.
+ * testsuite/ld-ctf/slice.d: Results adjusted.
+
2021-03-16 Nick Clifton <nickc@redhat.com>
* pe-dll.c (pe_find_cdecl_alias_match): Use memmove to overwrite
diff --git a/ld/testsuite/ld-ctf/slice.c b/ld/testsuite/ld-ctf/slice.c
index 7937bcf..fb38852 100644
--- a/ld/testsuite/ld-ctf/slice.c
+++ b/ld/testsuite/ld-ctf/slice.c
@@ -1,6 +1,9 @@
+enum foo { FOO_BAR };
+
struct slices {
int one : 1;
int two : 2;
int six : 6;
int ten :10;
+ enum foo bar:1;
} slices;
diff --git a/ld/testsuite/ld-ctf/slice.d b/ld/testsuite/ld-ctf/slice.d
index d116782..72a7074 100644
--- a/ld/testsuite/ld-ctf/slice.d
+++ b/ld/testsuite/ld-ctf/slice.d
@@ -15,7 +15,7 @@ Contents of CTF section .ctf:
Compilation unit name: .*slice.c
#...
Data object section: .* \(0x4 bytes\)
- Type section: .* \(0x9c bytes\)
+ Type section: .* \(0xd0 bytes\)
String section: .*
#...
Data objects:
@@ -28,5 +28,5 @@ Contents of CTF section .ctf:
*\[0x1\] two: ID 0x[0-9a-f]*: \(kind 1\) int:2 \[slice 0x1:0x2\] \(format 0x1\) \(size 0x1\) \(aligned at 0x1\)
*\[0x3\] six: ID 0x[0-9a-f]*: \(kind 1\) int:6 \[slice 0x3:0x6\] \(format 0x1\) \(size 0x1\) \(aligned at 0x1\)
*\[0x9\] ten: ID 0x[0-9a-f]*: \(kind 1\) int:10 \[slice 0x9:0xa\] \(format 0x1\) \(size 0x2\) \(aligned at 0x2\)
-
+ *\[0x13\] bar: ID 0x[0-9a-f]*: \(kind 8\) enum foo:1 \[slice 0x13:0x1\] \(format 0x1\) \(size 0x1\) \(aligned at 0x1\)
#...