libctf, ld: fix data symbol test with newer GCC
authorNick Alcock <nick.alcock@oracle.com>
Tue, 19 Jan 2021 12:45:18 +0000 (12:45 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 19 Jan 2021 12:45:18 +0000 (12:45 +0000)
GCC 11+ spots that the extern var_1 and var_666 declarations in this
test are unused, and removes them, thus stopping them from appearing as
conflicted data symbols and rendering the test pointless.  Use them in a
function unique to this TU to prevent them from being eliminated.

ld/ChangeLog
2021-01-19  Nick Alcock  <nick.alcock@oracle.com>

* testsuite/ld-ctf/data-func-2.c: Stop removal of the extern foo_t
symbols by the optimizer.
* testsuite/ld-ctf/data-func-conflicted.d: Adjust accordingly.

ld/ChangeLog
ld/testsuite/ld-ctf/data-func-2.c
ld/testsuite/ld-ctf/data-func-conflicted.d

index 035e6aa3fdcf5400571c7e2bad9e1c10bcfb5b98..aae89381fc23125c9b74113a34342e1ffdf38a4d 100644 (file)
@@ -1,3 +1,9 @@
+2021-01-19  Nick Alcock  <nick.alcock@oracle.com>
+
+       * testsuite/ld-ctf/data-func-2.c: Stop removal of the extern foo_t
+       symbols by the optimizer.
+       * testsuite/ld-ctf/data-func-conflicted.d: Adjust accordingly.
+
 2021-01-19  Nelson Chu  <nelson.chu@sifive.com>
 
        * testsuite/ld-elf/elf.exp (riscv_little_endian): Added.  Return true
index d00d230969279e2ccc8441e94157bfa3410430f3..575b06ef30c6d22f6c0a0511a47a40dc9766f861 100644 (file)
@@ -3,3 +3,7 @@ typedef char foo_t;
 /* Conflicting, and indexed.  */
 extern foo_t var_1;
 extern foo_t *var_666;
+
+int other_func(foo_t *);
+
+int ignore (void) { other_func (&var_1); other_func (var_666); }
index 6b1e9145a025dd96ff8aad1beb07914ffbdc02c8..1e7c19a5b364401f7e8b8be55b5e48bfc1cbebe2 100644 (file)
@@ -14,9 +14,9 @@ Contents of CTF section \.ctf:
     Version: 4 \(CTF_VERSION_3\)
 #...
     Data object section:       .* \(0xc bytes\)
-    Function info section:     .* \(0x40 bytes\)
+    Function info section:     .* \(0x44 bytes\)
     Object index section:      .* \(0xc bytes\)
-    Type section:      .* \(0xe8 bytes\)
+    Type section:      .* \(0xf4 bytes\)
     String section:    .*
 #...
   Data objects: