This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gold/testsuite: Add __attribute__((__aligned__(1))) to unaligned symbols from scripts.


This makes script_test_1, script_test_2, script_test_12, script_test12i, binary_test pass on 64-bit s390. Without this patch, compiler emits larl instructions to load symbol values, assuming they'll be aligned to 2 bytes (like all symbols are on s390 by default). larl only works on aligned targets, and bad things happen.
>From d8525c9cea9ec235f8162f9127b84b278784c78b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= <koriakin@0x04.net>
Date: Sun, 27 Sep 2015 15:04:08 +0200
Subject: [PATCH 09/10] gold/testsuite: Add __attribute__((__aligned__(1))) to
 unaligned symbols from scripts.

---
 gold/testsuite/binary_test.cc    |  6 +++---
 gold/testsuite/script_test_12a.c |  2 +-
 gold/testsuite/script_test_1a.cc |  9 ++++++++-
 gold/testsuite/script_test_2.cc  | 18 +++++++++---------
 4 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/gold/testsuite/binary_test.cc b/gold/testsuite/binary_test.cc
index 4ee9868..6b516fc 100644
--- a/gold/testsuite/binary_test.cc
+++ b/gold/testsuite/binary_test.cc
@@ -28,9 +28,9 @@
 #include <cstring>
 #include <stdint.h>
 
-extern char _binary_binary_txt_start[];
-extern char _binary_binary_txt_end[];
-extern char _binary_binary_txt_size[];
+extern char _binary_binary_txt_start[] __attribute__((__aligned__(1)));
+extern char _binary_binary_txt_end[] __attribute__((__aligned__(1)));
+extern char _binary_binary_txt_size[] __attribute__((__aligned__(1)));
 
 int
 main(int, char**)
diff --git a/gold/testsuite/script_test_12a.c b/gold/testsuite/script_test_12a.c
index 6540027..85887a4 100644
--- a/gold/testsuite/script_test_12a.c
+++ b/gold/testsuite/script_test_12a.c
@@ -51,7 +51,7 @@
 
 extern int test_array_start;
 extern int test_array_end;
-extern char interleaved;
+extern char interleaved __attribute__((__aligned__(1)));
 
 int
 main(void)
diff --git a/gold/testsuite/script_test_1a.cc b/gold/testsuite/script_test_1a.cc
index 648b42a..56dd2a9 100644
--- a/gold/testsuite/script_test_1a.cc
+++ b/gold/testsuite/script_test_1a.cc
@@ -24,7 +24,14 @@
 
 #include "script_test_1.h"
 
-extern char a, b, c, d, e, f, g;
+extern char
+  a __attribute__((__aligned__(1))),
+  b __attribute__((__aligned__(1))),
+  c __attribute__((__aligned__(1))),
+  d __attribute__((__aligned__(1))),
+  e __attribute__((__aligned__(1))),
+  f __attribute__((__aligned__(1))),
+  g __attribute__((__aligned__(1)));
 int sym = 3;
 int common_sym;
 
diff --git a/gold/testsuite/script_test_2.cc b/gold/testsuite/script_test_2.cc
index 80ca246..9fcacb0 100644
--- a/gold/testsuite/script_test_2.cc
+++ b/gold/testsuite/script_test_2.cc
@@ -28,15 +28,15 @@
 #include <cstring>
 #include <stdint.h>
 
-extern char start_test_area[];
-extern char start_test_area_1[];
-extern char start_data[];
-extern char end_data[];
-extern char start_fill[];
-extern char end_fill[];
-extern char end_test_area[];
-extern char test_addr[];
-extern char test_addr_alias[];
+extern char start_test_area[] __attribute__((__aligned__(1)));
+extern char start_test_area_1[] __attribute__((__aligned__(1)));
+extern char start_data[] __attribute__((__aligned__(1)));
+extern char end_data[] __attribute__((__aligned__(1)));
+extern char start_fill[] __attribute__((__aligned__(1)));
+extern char end_fill[] __attribute__((__aligned__(1)));
+extern char end_test_area[] __attribute__((__aligned__(1)));
+extern char test_addr[] __attribute__((__aligned__(1)));
+extern char test_addr_alias[] __attribute__((__aligned__(1)));
 
 int
 main(int, char**)
-- 
2.5.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]