Fix bug when optimizing string pools of aligned strings.
authorCary Coutant <ccoutant@gmail.com>
Sun, 22 Mar 2015 04:09:46 +0000 (21:09 -0700)
committerCary Coutant <ccoutant@gmail.com>
Sun, 22 Mar 2015 04:09:46 +0000 (21:09 -0700)
Tail optimization of string pools (enabled when linker is run with -O2
or greater) should not be done when the section alignment is greater
than the size of the characters in the strings; otherwise, unaligned
strings may result.

gold/
PR gold/18010
* stringpool.cc (Stringpool_template): Don't optimize if section
alignment is greater than sizeof(char).

gold/ChangeLog
gold/stringpool.cc

index d65c555ad5a5abfbf6a45b181e31dca25ceffe79..cc0aed32ef1c165b74b851c96843bb2582ca878c 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-21  Cary Coutant  <cary@google.com>
+
+       PR gold/18010
+       * stringpool.cc (Stringpool_template): Don't optimize if section
+       alignment is greater than sizeof(char).
+
 2015-03-21  Cary Coutant  <cary@google.com>
 
        PR gold/18048
index c6d3c9b584a6d88ac8389fb359445c33b96265d4..d6fd7157bf0fbd53b21111dc7006a7343af2a26d 100644 (file)
@@ -39,7 +39,9 @@ Stringpool_template<Stringpool_char>::Stringpool_template(uint64_t addralign)
     zero_null_(true), optimize_(false), offset_(sizeof(Stringpool_char)),
     addralign_(addralign)
 {
-  if (parameters->options_valid() && parameters->options().optimize() >= 2)
+  if (parameters->options_valid()
+      && parameters->options().optimize() >= 2
+      && addralign <= sizeof(Stringpool_char))
     this->optimize_ = true;
 }
 
This page took 0.032944 seconds and 4 git commands to generate.