Why is _dl_relocate_static_pie linked into crt1.o?

Message ID a8d8379d-0a79-d027-86ec-50a2d4412ce2@redhat.com
State Committed
Headers

Commit Message

Florian Weimer July 5, 2018, 6:24 p.m. UTC
  On 07/05/2018 04:23 PM, Carlos O'Donell wrote:
> Can we fix this with a subsequent CFLAGS-static-reloc.o override?
> 
> I'm hesitant to make any major changes now that we are in slushy freeze
> fro the release.

Like with the attached patch?

It covers the csu/elf-init.c situation as well, assuming that we we 
don't want to include the startup cleanup in this release.

Thanks,
Florian
  

Comments

Carlos O'Donell July 5, 2018, 8:51 p.m. UTC | #1
On 07/05/2018 02:24 PM, Florian Weimer wrote:
> On 07/05/2018 04:23 PM, Carlos O'Donell wrote:
>> Can we fix this with a subsequent CFLAGS-static-reloc.o override?
>>
>> I'm hesitant to make any major changes now that we are in slushy freeze
>> fro the release.
> 
> Like with the attached patch?

This patch looks good to me.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> It covers the csu/elf-init.c situation as well, assuming that we we don't want to include the startup cleanup in this release.
 
The startup cleanup is something that would be really nice to have,
let me look at the complexity of the changes.
 
> Subject: [PATCH] Build csu/elf-init.c and csu/static-reloc.c with stack protector
> To: libc-alpha@sourceware.org
> 
> This does not change generated code (with -fstack-protector-strong), but
> is important for formal compiler flags compliance.
> 
> 2018-07-05  Florian Weimer  <fweimer@redhat.com>
> 
> 	* csu/Makefile (CFLAGS-static-reloc.os): Build with stack
> 	protector.
> 	(CFLAGS-elf-init.oS): Likewise.
> 
> diff --git a/csu/Makefile b/csu/Makefile
> index f3498960f8..250fe664bd 100644
> --- a/csu/Makefile
> +++ b/csu/Makefile
> @@ -50,6 +50,19 @@ CFLAGS-.o += $(no-stack-protector)
>  CFLAGS-.op += $(no-stack-protector)
>  CFLAGS-.os += $(no-stack-protector)
>  
> +# Dummy object not actually part of anything.
> +# See <https://sourceware.org/ml/libc-alpha/2018-07/msg00101.html>.
> +# NB: Using $(stack-protector) in this way causes a wrong definition
> +# STACK_PROTECTOR_LEVEL due to the preceding $(no-stack-protector),
> +# but it does not matter for this source file.
> +CFLAGS-static-reloc.os += $(stack-protector)
> +
> +# This file is not actually part of the startup code in the nonshared
> +# case.  See <https://sourceware.org/bugzilla/show_bug.cgi?id=23323>,
> +# <https://sourceware.org/ml/libc-alpha/2018-06/msg00717.html>.
> +# See the NB above regarding STACK_PROTECTOR_LEVEL.
> +CFLAGS-elf-init.oS += $(stack-protector)
> +
>  ifeq (yes,$(build-shared))
>  extra-objs += S$(start-installed-name) gmon-start.os
>  ifneq ($(start-installed-name),$(static-start-installed-name))
  

Patch

Subject: [PATCH] Build csu/elf-init.c and csu/static-reloc.c with stack protector
To: libc-alpha@sourceware.org

This does not change generated code (with -fstack-protector-strong), but
is important for formal compiler flags compliance.

2018-07-05  Florian Weimer  <fweimer@redhat.com>

	* csu/Makefile (CFLAGS-static-reloc.os): Build with stack
	protector.
	(CFLAGS-elf-init.oS): Likewise.

diff --git a/csu/Makefile b/csu/Makefile
index f3498960f8..250fe664bd 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -50,6 +50,19 @@  CFLAGS-.o += $(no-stack-protector)
 CFLAGS-.op += $(no-stack-protector)
 CFLAGS-.os += $(no-stack-protector)
 
+# Dummy object not actually part of anything.
+# See <https://sourceware.org/ml/libc-alpha/2018-07/msg00101.html>.
+# NB: Using $(stack-protector) in this way causes a wrong definition
+# STACK_PROTECTOR_LEVEL due to the preceding $(no-stack-protector),
+# but it does not matter for this source file.
+CFLAGS-static-reloc.os += $(stack-protector)
+
+# This file is not actually part of the startup code in the nonshared
+# case.  See <https://sourceware.org/bugzilla/show_bug.cgi?id=23323>,
+# <https://sourceware.org/ml/libc-alpha/2018-06/msg00717.html>.
+# See the NB above regarding STACK_PROTECTOR_LEVEL.
+CFLAGS-elf-init.oS += $(stack-protector)
+
 ifeq (yes,$(build-shared))
 extra-objs += S$(start-installed-name) gmon-start.os
 ifneq ($(start-installed-name),$(static-start-installed-name))