* clang/ld.lld build fails with `can't create dynamic relocation R_PPC64_ADDR64 against local symbol in readonly segment`
@ 2021-07-29 8:23 Paul Menzel
2021-08-10 18:38 ` Paul Menzel
0 siblings, 1 reply; 5+ messages in thread
From: Paul Menzel @ 2021-07-29 8:23 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
Cc: Derek Parker, Dmitrii Okunev, linuxppc-dev
Dear Linux folks,
I just wanted to make you aware that building Linux for ppc64le with
clang/lld.ld fails with [1]:
ld.lld: error: can't create dynamic relocation R_PPC64_ADDR64
against symbol: empty_zero_page in readonly segment; recompile object
files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in
the output
>>> defined in arch/powerpc/kernel/head_64.o
>>> referenced by
arch/powerpc/kernel/head_64.o:(___ksymtab+empty_zero_page+0x0)
The patch below from one of the comments [2] fixes it.
--- i/arch/powerpc/Makefile
+++ w/arch/powerpc/Makefile
@@ -122,7 +122,7 @@ cflags-$(CONFIG_STACKPROTECTOR) +=
-mstack-protector-guard-reg=r2
endif
LDFLAGS_vmlinux-y := -Bstatic
-LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
+LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie -z notext
LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
LDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn)
Kind regards,
Paul
[1]: https://github.com/ClangBuiltLinux/linux/issues/811
[2]:
https://github.com/ClangBuiltLinux/linux/issues/811#issuecomment-568316320
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: clang/ld.lld build fails with `can't create dynamic relocation R_PPC64_ADDR64 against local symbol in readonly segment`
2021-07-29 8:23 clang/ld.lld build fails with `can't create dynamic relocation R_PPC64_ADDR64 against local symbol in readonly segment` Paul Menzel
@ 2021-08-10 18:38 ` Paul Menzel
2021-08-11 14:10 ` Christophe Leroy
2021-08-12 5:46 ` Michael Ellerman
0 siblings, 2 replies; 5+ messages in thread
From: Paul Menzel @ 2021-08-10 18:38 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
Cc: Derek Parker, Dmitrii Okunev, linuxppc-dev
Dear Linux folks,
Am 29.07.21 um 10:23 schrieb Paul Menzel:
> I just wanted to make you aware that building Linux for ppc64le with
> clang/lld.ld fails with [1]:
>
> ld.lld: error: can't create dynamic relocation R_PPC64_ADDR64
> against symbol: empty_zero_page in readonly segment; recompile object
> files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in
> the output
> >>> defined in arch/powerpc/kernel/head_64.o
> >>> referenced by
> arch/powerpc/kernel/head_64.o:(___ksymtab+empty_zero_page+0x0)
>
> The patch below from one of the comments [2] fixes it.
>
> --- i/arch/powerpc/Makefile
> +++ w/arch/powerpc/Makefile
> @@ -122,7 +122,7 @@ cflags-$(CONFIG_STACKPROTECTOR) +=
> -mstack-protector-guard-reg=r2
> endif
>
> LDFLAGS_vmlinux-y := -Bstatic
> -LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
> +LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie -z notext
> LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
> LDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn)
Any comments, if this is the right fix? Current Linux master branch
still fails to build with `LLVM=1` on Ubuntu 21.04 without this change.
Kind regards,
Paul
> [1]: https://github.com/ClangBuiltLinux/linux/issues/811
> [2]: https://github.com/ClangBuiltLinux/linux/issues/811#issuecomment-568316320
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: clang/ld.lld build fails with `can't create dynamic relocation R_PPC64_ADDR64 against local symbol in readonly segment`
2021-08-10 18:38 ` Paul Menzel
@ 2021-08-11 14:10 ` Christophe Leroy
2021-08-11 23:09 ` Paul Menzel
2021-08-12 5:46 ` Michael Ellerman
1 sibling, 1 reply; 5+ messages in thread
From: Christophe Leroy @ 2021-08-11 14:10 UTC (permalink / raw)
To: Paul Menzel, Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
Cc: Derek Parker, Dmitrii Okunev, linuxppc-dev
Le 10/08/2021 à 20:38, Paul Menzel a écrit :
> Dear Linux folks,
>
>
> Am 29.07.21 um 10:23 schrieb Paul Menzel:
>
>> I just wanted to make you aware that building Linux for ppc64le with clang/lld.ld fails with [1]:
>>
>> ld.lld: error: can't create dynamic relocation R_PPC64_ADDR64 against symbol: empty_zero_page
>> in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text
>> relocations in the output
>> >>> defined in arch/powerpc/kernel/head_64.o
>> >>> referenced by arch/powerpc/kernel/head_64.o:(___ksymtab+empty_zero_page+0x0)
>>
>> The patch below from one of the comments [2] fixes it.
>>
>> --- i/arch/powerpc/Makefile
>> +++ w/arch/powerpc/Makefile
>> @@ -122,7 +122,7 @@ cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r2
>> endif
>>
>> LDFLAGS_vmlinux-y := -Bstatic
>> -LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
>> +LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie -z notext
>> LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
>> LDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn)
>
> Any comments, if this is the right fix? Current Linux master branch still fails to build with
> `LLVM=1` on Ubuntu 21.04 without this change.
Which kernel version are you building ?
Since https://github.com/linuxppc/linux/commit/45b30fafe528601f1a4449c9d68d8ebe7bbc39ad ,
empty_zero_page[] is in arch/powerpc/mm/mem.c not in arch/powerpc/kernel/head_64.o
Do you still have the issue with kernel 5.14 ?
Christophe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: clang/ld.lld build fails with `can't create dynamic relocation R_PPC64_ADDR64 against local symbol in readonly segment`
2021-08-11 14:10 ` Christophe Leroy
@ 2021-08-11 23:09 ` Paul Menzel
0 siblings, 0 replies; 5+ messages in thread
From: Paul Menzel @ 2021-08-11 23:09 UTC (permalink / raw)
To: Christophe Leroy, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras
Cc: Derek Parker, Dmitrii Okunev, linuxppc-dev
Dear Christophe,
Am 11.08.21 um 16:10 schrieb Christophe Leroy:
> Le 10/08/2021 à 20:38, Paul Menzel a écrit :
>> Am 29.07.21 um 10:23 schrieb Paul Menzel:
>>
>>> I just wanted to make you aware that building Linux for ppc64le with
>>> clang/lld.ld fails with [1]:
>>>
>>> ld.lld: error: can't create dynamic relocation R_PPC64_ADDR64
>>> against symbol: empty_zero_page in readonly segment; recompile object
>>> files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in
>>> the output
>>> >>> defined in arch/powerpc/kernel/head_64.o
>>> >>> referenced by
>>> arch/powerpc/kernel/head_64.o:(___ksymtab+empty_zero_page+0x0)
>>>
>>> The patch below from one of the comments [2] fixes it.
>>>
>>> --- i/arch/powerpc/Makefile
>>> +++ w/arch/powerpc/Makefile
>>> @@ -122,7 +122,7 @@ cflags-$(CONFIG_STACKPROTECTOR) +=
>>> -mstack-protector-guard-reg=r2
>>> endif
>>>
>>> LDFLAGS_vmlinux-y := -Bstatic
>>> -LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
>>> +LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie -z notext
>>> LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
>>> LDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn)
>>
>> Any comments, if this is the right fix? Current Linux master branch
>> still fails to build with `LLVM=1` on Ubuntu 21.04 without this change.
>
> Which kernel version are you building ?
>
> Since
> https://github.com/linuxppc/linux/commit/45b30fafe528601f1a4449c9d68d8ebe7bbc39ad
> , empty_zero_page[] is in arch/powerpc/mm/mem.c not in
> arch/powerpc/kernel/head_64.o
>
> Do you still have the issue with kernel 5.14 ?
Yes, before sending the message, I reproduced it with
$ git describe
v5.14-rc5-2-g9a73fa375d58
containing the commit you mentioned.
Kind regards,
Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: clang/ld.lld build fails with `can't create dynamic relocation R_PPC64_ADDR64 against local symbol in readonly segment`
2021-08-10 18:38 ` Paul Menzel
2021-08-11 14:10 ` Christophe Leroy
@ 2021-08-12 5:46 ` Michael Ellerman
1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2021-08-12 5:46 UTC (permalink / raw)
To: Paul Menzel, Benjamin Herrenschmidt, Paul Mackerras
Cc: Derek Parker, Dmitrii Okunev, linuxppc-dev
Paul Menzel <pmenzel@molgen.mpg.de> writes:
> Am 29.07.21 um 10:23 schrieb Paul Menzel:
>
>> I just wanted to make you aware that building Linux for ppc64le with
>> clang/lld.ld fails with [1]:
>>
>> ld.lld: error: can't create dynamic relocation R_PPC64_ADDR64
>> against symbol: empty_zero_page in readonly segment; recompile object
>> files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in
>> the output
>> >>> defined in arch/powerpc/kernel/head_64.o
>> >>> referenced by
>> arch/powerpc/kernel/head_64.o:(___ksymtab+empty_zero_page+0x0)
>>
>> The patch below from one of the comments [2] fixes it.
>>
>> --- i/arch/powerpc/Makefile
>> +++ w/arch/powerpc/Makefile
>> @@ -122,7 +122,7 @@ cflags-$(CONFIG_STACKPROTECTOR) +=
>> -mstack-protector-guard-reg=r2
>> endif
>>
>> LDFLAGS_vmlinux-y := -Bstatic
>> -LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
>> +LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie -z notext
>> LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
>> LDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn)
>
> Any comments, if this is the right fix? Current Linux master branch
> still fails to build with `LLVM=1` on Ubuntu 21.04 without this change.
Sorry but I have no idea if it's the right fix. What I need is the
author (or someone else) to send a patch with a change log explaining
the change, what it does, why it's right for llvm, and why it's right
for binutils.
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-12 5:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 8:23 clang/ld.lld build fails with `can't create dynamic relocation R_PPC64_ADDR64 against local symbol in readonly segment` Paul Menzel
2021-08-10 18:38 ` Paul Menzel
2021-08-11 14:10 ` Christophe Leroy
2021-08-11 23:09 ` Paul Menzel
2021-08-12 5:46 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.