Place $(elf-objpfx)sofini.os the last [BZ #22051]

Message ID CAMe9rOoGgocdnSA5VHr1f-X=nkbchMCrUcZ2uYKm71F2W_ijvg@mail.gmail.com
State New, archived
Headers

Commit Message

H.J. Lu Aug. 31, 2017, 11:05 a.m. UTC
  On Thu, Aug 31, 2017 at 3:57 AM, Andreas Schwab <schwab@suse.de> wrote:
> On Aug 31 2017, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>
>> +# sofini.os must be the last since it terminates .eh_frame section.
>
> s/the// || s/the/placed/
>
> Andreas.

Like this?
  

Comments

Andreas Schwab Aug. 31, 2017, 1:09 p.m. UTC | #1
On Aug 31 2017, "H.J. Lu" <hjl.tools@gmail.com> wrote:

> 	[BZ #22051]
> 	* Makerules (build-module-helper-objlist): Filter out
> 	$(elf-objpfx)sofini.os.
> 	(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
> 	needed.

Ok.

Andreas.
  
H.J. Lu Sept. 1, 2017, 3:07 p.m. UTC | #2
On Thu, Aug 31, 2017 at 6:09 AM, Andreas Schwab <schwab@suse.de> wrote:
> On Aug 31 2017, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>
>>       [BZ #22051]
>>       * Makerules (build-module-helper-objlist): Filter out
>>       $(elf-objpfx)sofini.os.
>>       (build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
>>       needed.
>
> Ok.
>

I'd like to backport it to 2.25 and 2.26 branches.   Any objections?

Thanks.
  
H.J. Lu Sept. 7, 2017, 3:24 p.m. UTC | #3
On Fri, Sep 1, 2017 at 8:07 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Aug 31, 2017 at 6:09 AM, Andreas Schwab <schwab@suse.de> wrote:
>> On Aug 31 2017, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>>
>>>       [BZ #22051]
>>>       * Makerules (build-module-helper-objlist): Filter out
>>>       $(elf-objpfx)sofini.os.
>>>       (build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
>>>       needed.
>>
>> Ok.
>>
>
> I'd like to backport it to 2.25 and 2.26 branches.   Any objections?
>

I am backporting it to 2.25 and 2.26 branches now.

H.J.
  

Patch

From 953d46ebe8cf0bf24c78b7ab0306cd035d413411 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 30 Aug 2017 21:26:53 -0700
Subject: [PATCH] Place $(elf-objpfx)sofini.os last [BZ #22051]

Since sofini.os terminates .eh_frame section, it should be placed last.

	[BZ #22051]
	* Makerules (build-module-helper-objlist): Filter out
	$(elf-objpfx)sofini.os.
	(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
	needed.
---
 Makerules | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makerules b/Makerules
index 8f1324d8e9..bbfbefe33f 100644
--- a/Makerules
+++ b/Makerules
@@ -686,14 +686,17 @@  $(build-module-helper) -o $@ $(shlib-lds-flags) \
 $(call after-link,$@)
 endef
 
+# sofini.os must be placed last since it terminates .eh_frame section.
 build-module-helper-objlist = \
 	$(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
 		   $(filter-out %.lds $(map-file) $(+preinit) $(+postinit) \
+				$(elf-objpfx)sofini.os \
 				$(link-libc-deps),$^))
 
 build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)
 build-shlib-objlist = $(build-module-helper-objlist) \
-		      $(LDLIBS-$(@F:lib%.so=%).so)
+		      $(LDLIBS-$(@F:lib%.so=%).so) \
+		      $(filter $(elf-objpfx)sofini.os,$^)
 
 # Don't try to use -lc when making libc.so itself.
 # Also omits crti.o and crtn.o, which we do not want
-- 
2.13.5