diff mbox

[8/9] arm64: Add missing AT() macros to vmlinux.lds.S

Message ID 2f23e828983b41b1b3844da028f698272b04e83c.1408736066.git.geoff@infradead.org (mailing list archive)
State New, archived
Headers show

Commit Message

Geoff Levand Aug. 22, 2014, 7:49 p.m. UTC
The existing arm64 linker script uses some pre-defined section macros from
vmlinux.lds.h, all of which include a section load address attribute of
'AT(ADDR(section) - LOAD_OFFSET)'.  LOAD_OFFSET is not defined for arm64, and
defaults to zero, so this mix of section attributions has no ill effect.

For consistency and to clear the way for a possible definition of LOAD_OFFSET
add any missing AT() macros to vmlinux.lds.S.

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 arch/arm64/kernel/vmlinux.lds.S | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Catalin Marinas Aug. 26, 2014, 4:08 p.m. UTC | #1
On Fri, Aug 22, 2014 at 08:49:17PM +0100, Geoff Levand wrote:
> The existing arm64 linker script uses some pre-defined section macros from
> vmlinux.lds.h, all of which include a section load address attribute of
> 'AT(ADDR(section) - LOAD_OFFSET)'.  LOAD_OFFSET is not defined for arm64, and
> defaults to zero, so this mix of section attributions has no ill effect.
> 
> For consistency and to clear the way for a possible definition of LOAD_OFFSET
> add any missing AT() macros to vmlinux.lds.S.

So, what's the possible definition for LOAD_OFFSET on arm64?
Geoff Levand Aug. 26, 2014, 7:33 p.m. UTC | #2
Catalin,

On Tue, 2014-08-26 at 17:08 +0100, Catalin Marinas wrote:
> On Fri, Aug 22, 2014 at 08:49:17PM +0100, Geoff Levand wrote:
> > The existing arm64 linker script uses some pre-defined section macros from
> > vmlinux.lds.h, all of which include a section load address attribute of
> > 'AT(ADDR(section) - LOAD_OFFSET)'.  LOAD_OFFSET is not defined for arm64, and
> > defaults to zero, so this mix of section attributions has no ill effect.
> > 
> > For consistency and to clear the way for a possible definition of LOAD_OFFSET
> > add any missing AT() macros to vmlinux.lds.S.
> 
> So, what's the possible definition for LOAD_OFFSET on arm64?

Well, this is just intended as a cleanup for vmlinux.lds.S, but I think
a LOAD_OFFSET definition may be needed for kdump.

Takahiro, could you comment?

-Geoff
AKASHI Takahiro Aug. 27, 2014, 6:53 a.m. UTC | #3
On 08/27/2014 04:33 AM, Geoff Levand wrote:
> Catalin,
>
> On Tue, 2014-08-26 at 17:08 +0100, Catalin Marinas wrote:
>> On Fri, Aug 22, 2014 at 08:49:17PM +0100, Geoff Levand wrote:
>>> The existing arm64 linker script uses some pre-defined section macros from
>>> vmlinux.lds.h, all of which include a section load address attribute of
>>> 'AT(ADDR(section) - LOAD_OFFSET)'.  LOAD_OFFSET is not defined for arm64, and
>>> defaults to zero, so this mix of section attributions has no ill effect.
>>>
>>> For consistency and to clear the way for a possible definition of LOAD_OFFSET
>>> add any missing AT() macros to vmlinux.lds.S.
>>
>> So, what's the possible definition for LOAD_OFFSET on arm64?
>
> Well, this is just intended as a cleanup for vmlinux.lds.S, but I think
> a LOAD_OFFSET definition may be needed for kdump.
>
> Takahiro, could you comment?

My current implementation of kdump doesn't assume use of LOAD_OFFSET since it can
utilize, as crash (2nd stage) kernel, the same one as 1st stage kernel.

The loaded address and entry address will be handled properly by userspace tool, kexec,
as far as TEXT_OFFSET is reasonably small (that is, fit into the memory region dedicated
for crash kernel).

-Takahiro AKASHI

> -Geoff
>
>
diff mbox

Patch

diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index 8dc1d46..07d41aa 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -50,11 +50,11 @@  SECTIONS
 
 	. = PAGE_OFFSET + TEXT_OFFSET;
 
-	.head.text : {
+	.head.text : AT(ADDR(.head.text) - LOAD_OFFSET) {
 		_text = .;
 		HEAD_TEXT
 	}
-	.text : {			/* Real text segment		*/
+	.text : AT(ADDR(.text) - LOAD_OFFSET) { /* Real text segment	*/
 		_stext = .;		/* Text and read-only data	*/
 			__exception_text_start = .;
 			*(.exception.text)
@@ -79,11 +79,11 @@  SECTIONS
 	__init_begin = .;
 
 	INIT_TEXT_SECTION(8)
-	.exit.text : {
+	.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
 		ARM_EXIT_KEEP(EXIT_TEXT)
 	}
 	. = ALIGN(16);
-	.init.data : {
+	.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
 		INIT_DATA
 		INIT_SETUP(16)
 		INIT_CALLS
@@ -91,7 +91,7 @@  SECTIONS
 		SECURITY_INITCALL
 		INIT_RAM_FS
 	}
-	.exit.data : {
+	.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET){
 		ARM_EXIT_KEEP(EXIT_DATA)
 	}