public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: binutils@sourceware.org
Subject: gold patch committed: Copy TLS fix to 2.21 branch
Date: Tue, 01 Mar 2011 21:50:00 -0000	[thread overview]
Message-ID: <mcrwrkia4tj.fsf@google.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 295 bytes --]

I have committed this gold patch to the binutils 2.21 branch.

Ian


2011-03-01  Ian Lance Taylor  <iant@google.com>

	Backport from mainline:
	2011-01-04  Cary Coutant  <ccoutant@google.com>
	* script-sections.cc (Sort_output_sections::operator()): Sort TLS
	sections before NOBITS sections.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1564 bytes --]

Index: script-sections.cc
===================================================================
RCS file: /cvs/src/src/gold/script-sections.cc,v
retrieving revision 1.46
diff -u -p -r1.46 script-sections.cc
--- script-sections.cc	3 Nov 2010 14:07:49 -0000	1.46
+++ script-sections.cc	1 Mar 2011 21:49:52 -0000
@@ -1,6 +1,6 @@
 // script-sections.cc -- linker script SECTIONS for gold
 
-// Copyright 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -3586,17 +3586,18 @@ Sort_output_sections::operator()(const O
   if (os1->address() != os2->address())
     return os1->address() < os2->address();
 
-  // Sort TLS sections to the end.
+  // Sort PROGBITS before NOBITS.
+  bool nobits1 = os1->type() == elfcpp::SHT_NOBITS;
+  bool nobits2 = os2->type() == elfcpp::SHT_NOBITS;
+  if (nobits1 != nobits2)
+    return nobits2;
+
+  // Sort PROGBITS TLS sections to the end, NOBITS TLS sections to the
+  // beginning.
   bool tls1 = (os1->flags() & elfcpp::SHF_TLS) != 0;
   bool tls2 = (os2->flags() & elfcpp::SHF_TLS) != 0;
   if (tls1 != tls2)
-    return tls2;
-
-  // Sort PROGBITS before NOBITS.
-  if (os1->type() == elfcpp::SHT_PROGBITS && os2->type() == elfcpp::SHT_NOBITS)
-    return true;
-  if (os1->type() == elfcpp::SHT_NOBITS && os2->type() == elfcpp::SHT_PROGBITS)
-    return false;
+    return nobits1 ? tls1 : tls2;
 
   // Sort non-NOLOAD before NOLOAD.
   if (os1->is_noload() && !os2->is_noload())

                 reply	other threads:[~2011-03-01 21:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mcrwrkia4tj.fsf@google.com \
    --to=iant@google.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).