Skip to contentSkip to conversation

--build-id= none in newer ld versions PowerPC

PATCH Applied Manoel Rebelo Abranches 6 participants 14 messages Dec 1, 2008 – Apr 1, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 --build-id= none in newer ld versions PowerPC

This patch add --build-id=none option to newer ld versions when linking kernel.elf.
This prevents grub-mkelfimage to behave wrongly.

Signature · 4 lines
Best Regards,

Manoel Abranches <[email protected]>
IBM Linux Technology Center Brazil
aclocal.m4 +1 -0
Index: aclocal.m4
===================================================================
@@ -113,6 +113,7 @@
 
 if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
   MODULE_LDFLAGS="$MODULE_LDFLAGS -Wl,--build-id=none"
+  PPC_BUILD_ID_FLAG="-Wl,--build-id=none"
 fi
 ])
 
powerpc-ieee1275.rmk +1 -1
Index: conf/powerpc-ieee1275.rmk
===================================================================
@@ -87,7 +87,7 @@
 kernel_elf_CFLAGS = $(COMMON_CFLAGS)
 kernel_elf_ASFLAGS = $(COMMON_ASFLAGS)
 kernel_elf_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
-	-Wl,-N,-S,-Ttext,0x200000,-Bstatic
+	-Wl,-N,-S,-Ttext,0x200000,-Bstatic $(PPC_BUILD_ID_FLAG)
 
 # Scripts.
 sbin_SCRIPTS = grub-install
configure.ac +1 -0
Index: configure.ac
===================================================================
@@ -330,6 +330,7 @@
 AC_SUBST(TARGET_CPPFLAGS)
 AC_SUBST(TARGET_LDFLAGS)
 AC_SUBST(MODULE_LDFLAGS)
+AC_SUBST(PPC_BUILD_ID_FLAG)
 
 # Set them to their new values for the tests below.
 CC="$TARGET_CC"
Makefile.in +1 -0
Index: Makefile.in
===================================================================
@@ -73,6 +73,7 @@
 TARGET_IMG_LDFLAGS = @TARGET_IMG_LDFLAGS@
 TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
 MODULE_LDFLAGS = @MODULE_LDFLAGS@
+PPC_BUILD_ID_FLAG = @PPC_BUILD_ID_FLAG@
 EXEEXT = @EXEEXT@
 OBJCOPY = @OBJCOPY@
 STRIP = @STRIP@
ChangeLog +11 -0
Index: ChangeLog
===================================================================
@@ -1,3 +1,14 @@
+2008-12-01  Manoel R. Abranches <[email protected]>
+
+	Add option --build-id=none to ld when linking kernel.elf in powerpc
+	to prevent creating additional LOAD segments.
+	Patch made with help from Paulo R. Pinatti <[email protected]>.
+	* aclocal.m4: add --build-id=none to new variable when acceptable by
+	ld.
+	* conf/powerpc-ieee1275.rmk: New variable.
+	* configure.ac: New variable. 
+	* Makefile.in: New variable.
+
 2008-11-29  Robert Millan  <[email protected]>
 
 	* disk/ata.c (grub_ata_pciinit): Handle errors rised by
#1 lore raw
Quoted 10 lines · Manoel Rebelo Abranches

This patch add --build-id=none option to newer ld versions when linking kernel.elf.
This prevents grub-mkelfimage to behave wrongly.

if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
MODULE_LDFLAGS="$MODULE_LDFLAGS -Wl,--build-id=none"
+ PPC_BUILD_ID_FLAG="-Wl,--build-id=none"
fi
])

How about changing that to KERNEL_LDFLAGS? Then one could use it for other purposes if needed?

#2 lore raw
Quoted 12 lines · Vesa Jääskeläinen
Quoted 10 lines · Manoel Rebelo Abranches

This patch add --build-id=none option to newer ld versions when linking kernel.elf.
This prevents grub-mkelfimage to behave wrongly.

if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
MODULE_LDFLAGS="$MODULE_LDFLAGS -Wl,--build-id=none"
+ PPC_BUILD_ID_FLAG="-Wl,--build-id=none"
fi
])

Quoted 8 lines

How about changing that to KERNEL_LDFLAGS? Then one could use it for other purposes if needed?

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

There is already kernel_elf_LDFLAGS but its used for other architectures too.

Signature · 4 lines
Best Regards,

Manoel Abranches <[email protected]>
IBM Linux Technology Center Brazil
#3 lore raw
Quoted 11 lines · Manoel Rebelo Abranches
Quoted 10 lines · Vesa Jääskeläinen
Quoted 9 lines · Manoel Rebelo Abranches

This patch add --build-id=none option to newer ld versions when linking kernel.elf.
This prevents grub-mkelfimage to behave wrongly.

if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
MODULE_LDFLAGS="$MODULE_LDFLAGS -Wl,--build-id=none"
+ PPC_BUILD_ID_FLAG="-Wl,--build-id=none"
fi
])

Quoted 5 lines
Quoted 2 lines

How about changing that to KERNEL_LDFLAGS? Then one could use it for other purposes if needed?

There is already kernel_elf_LDFLAGS but its used for other architectures too.

No no. I mean just KERNEL_LDFLAGS like comparison to MODULE_LDFLAGS. No elf or nothing like that. Is there any problem if one provides this setting even on x86 if linker recognizes it? (what is being tested here). PPC_BUILD_ID_FLAG just sounds too specific.

Isn't EFI also using ELF? I assume this would be beneficial also there.

#4 lore raw
Quoted 6 lines · Vesa Jääskeläinen

No no. I mean just KERNEL_LDFLAGS like comparison to MODULE_LDFLAGS. No elf or nothing like that. Is there any problem if one provides this setting even on x86 if linker recognizes it? (what is being tested here). PPC_BUILD_ID_FLAG just sounds too specific.

Isn't EFI also using ELF? I assume this would be beneficial also there.

I agree, we should not be be multiplying hacks. There is already code adding -Wl,--build-id=none to TARGET_LDFLAGS. It's a macro grub_PROG_LD_BUILD_ID_NONE in aclocal.m4. What's wrong with it? Does it fail to add -Wl,--build-id=none on PowerPC or is TARGET_LDFLAGS not used to link kernel.elf?

What are the symptoms caused by not using -Wl,--build-id=none?

Signature · 2 lines
Regards,
Pavel Roskin
#5 lore raw

The variable TARGET_LDFLAGS. isnt set but MODULE_LDFLAGS is instead.

if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
MODULE_LDFLAGS="$MODULE_LDFLAGS -Wl,--build-id=none"

I could change to use TARGET_LDFLAGS if it wont brake other architectures.
We were using PPC_BUILD_ID_FLAG because it was intended to be only to PowerPC at first. I can tell if it is needed for others architectures and if it wont brake others as well.

Quoted 17 lines · Pavel Roskin
Quoted 6 lines · Vesa Jääskeläinen

No no. I mean just KERNEL_LDFLAGS like comparison to MODULE_LDFLAGS. No elf or nothing like that. Is there any problem if one provides this setting even on x86 if linker recognizes it? (what is being tested here). PPC_BUILD_ID_FLAG just sounds too specific.

Isn't EFI also using ELF? I assume this would be beneficial also there.

I agree, we should not be be multiplying hacks. There is already code adding -Wl,--build-id=none to TARGET_LDFLAGS. It's a macro grub_PROG_LD_BUILD_ID_NONE in aclocal.m4. What's wrong with it? Does it fail to add -Wl,--build-id=none on PowerPC or is TARGET_LDFLAGS not used to link kernel.elf?

What are the symptoms caused by not using -Wl,--build-id=none?

Signature · 4 lines
Best Regards,

Manoel Abranches <[email protected]>
IBM Linux Technology Center Brazil
#6 lore raw
In reply to Pavel Roskin

Hi made a patch to add --build-id=none to TARGET_LDFLAGS instead of MODULE_LDFLAGS. with this it is passed to ld when linking kernel.elf.

without this kernel.elf creates a additional LOAD segment with a virtual address in PhysAddr witch causes problem with OF and causes grub-mkelfimage to not work correctly.

Quoted 17 lines · Pavel Roskin
Quoted 6 lines · Vesa Jääskeläinen

No no. I mean just KERNEL_LDFLAGS like comparison to MODULE_LDFLAGS. No elf or nothing like that. Is there any problem if one provides this setting even on x86 if linker recognizes it? (what is being tested here). PPC_BUILD_ID_FLAG just sounds too specific.

Isn't EFI also using ELF? I assume this would be beneficial also there.

I agree, we should not be be multiplying hacks. There is already code adding -Wl,--build-id=none to TARGET_LDFLAGS. It's a macro grub_PROG_LD_BUILD_ID_NONE in aclocal.m4. What's wrong with it? Does it fail to add -Wl,--build-id=none on PowerPC or is TARGET_LDFLAGS not used to link kernel.elf?

What are the symptoms caused by not using -Wl,--build-id=none?

Signature · 4 lines
Best Regards,

Manoel Abranches <[email protected]>
IBM Linux Technology Center Brazil
aclocal.m4 +1 -1
Index: aclocal.m4
===================================================================
@@ -112,7 +112,7 @@
 AC_MSG_RESULT([$grub_cv_prog_ld_build_id_none])
 
 if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
-  MODULE_LDFLAGS="$MODULE_LDFLAGS -Wl,--build-id=none"
+  TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,--build-id=none"
 fi
 ])
 
ChangeLog +7 -0
Index: ChangeLog
===================================================================
@@ -1,3 +1,10 @@
+2008-12-04  Manoel R. Abranches <[email protected]>
+		
+	Add --build-id=none to all ld calls instead of only the ones related
+	to modules. This correct a problem with grub-mkelfimage.
+	* aclocal.m4: Move --build-id=none from MODULE_LDFLAGS to
+	TARGET_LDFLAGS
+
 2008-11-29  Robert Millan  <[email protected]>
 
 	* disk/ata.c (grub_ata_pciinit): Handle errors rised by
#7 lore raw

There are any objections for this patch? Without this grub wont work in PowerPC when using newer ld version.
thanks

Quoted 29 lines · Manoel Rebelo Abranches

Hi made a patch to add --build-id=none to TARGET_LDFLAGS instead of MODULE_LDFLAGS. with this it is passed to ld when linking kernel.elf.

without this kernel.elf creates a additional LOAD segment with a virtual address in PhysAddr witch causes problem with OF and causes grub-mkelfimage to not work correctly.

Quoted 9 lines · Pavel Roskin
Quoted 6 lines · Vesa Jääskeläinen

No no. I mean just KERNEL_LDFLAGS like comparison to MODULE_LDFLAGS. No elf or nothing like that. Is there any problem if one provides this setting even on x86 if linker recognizes it? (what is being tested here). PPC_BUILD_ID_FLAG just sounds too specific.

Isn't EFI also using ELF? I assume this would be beneficial also there.

Quoted 8 lines

I agree, we should not be be multiplying hacks. There is already code adding -Wl,--build-id=none to TARGET_LDFLAGS. It's a macro grub_PROG_LD_BUILD_ID_NONE in aclocal.m4. What's wrong with it? Does it fail to add -Wl,--build-id=none on PowerPC or is TARGET_LDFLAGS not used to link kernel.elf?

What are the symptoms caused by not using -Wl,--build-id=none?

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 4 lines
Best Regards,

Manoel Abranches <[email protected]>
IBM Linux Technology Center Brazil
#8 lore raw
In reply to Manoel Rebelo Abranches

Did anyone have any objections to this patch. Not sure if anyone had any craving to use --build-id. If not I'll check it in in the next week.

Jerone

Quoted 37 lines · Manoel Rebelo Abranches

Hi made a patch to add --build-id=none to TARGET_LDFLAGS instead of MODULE_LDFLAGS. with this it is passed to ld when linking kernel.elf.

without this kernel.elf creates a additional LOAD segment with a virtual address in PhysAddr witch causes problem with OF and causes grub-mkelfimage to not work correctly.

Quoted 9 lines · Pavel Roskin
Quoted 6 lines · Vesa Jääskeläinen

No no. I mean just KERNEL_LDFLAGS like comparison to MODULE_LDFLAGS. No elf or nothing like that. Is there any problem if one provides this setting even on x86 if linker recognizes it? (what is being tested here). PPC_BUILD_ID_FLAG just sounds too specific.

Isn't EFI also using ELF? I assume this would be beneficial also there.

Quoted 8 lines

I agree, we should not be be multiplying hacks. There is already code adding -Wl,--build-id=none to TARGET_LDFLAGS. It's a macro grub_PROG_LD_BUILD_ID_NONE in aclocal.m4. What's wrong with it? Does it fail to add -Wl,--build-id=none on PowerPC or is TARGET_LDFLAGS not used to link kernel.elf?

What are the symptoms caused by not using -Wl,--build-id=none?

--
Best Regards,

Manoel Abranches <[email protected]>
IBM Linux Technology Center Brazil

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

#9 lore raw

Quoting Jerone Young <[email protected]>:

Quoted 2 lines

Did anyone have any objections to this patch. Not sure if anyone had any craving to use --build-id. If not I'll check it in in the next week.

Where is the current version of the patch? Can we have a look first?

Signature · 2 lines
Regards,
Pavel Roskin
#11 lore raw
Quoted 17 lines · Jerone Young

http://lists.gnu.org/archive/html/grub-devel/2008-12/msg00024.html

It is the attachment.

Quoted 11 lines · Pavel Roskin

Quoting Jerone Young <[email protected]>:

Did anyone have any objections to this patch. Not sure if anyone had any

Quoted 2 lines

craving to use --build-id. If not I'll check it in in the next week.

Where is the current version of the patch? Can we have a look first?

--
Regards,
Pavel Roskin

It seems nobody objected...

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#12 lore raw

Hello!
Folks I gave up objecting on things discussed here, and then ending up in a patch, about three days into the whole discussion that eventually created code in SVN for GRUB2.

Therefore if anything does come up and you, Robert, feel I should comment, please say so.

I do have one thing to complain about, the use of signed e-mail on a public list that can be searched via Google. Regardless of how the credentials are created, they could be found and copied and worse used against the person who created.
--
Gregg C Levine [email protected]
"The Force will be with you always." Obi-Wan Kenobi

Quoted 2 lines

-----Original Message-----
From: [email protected]

[mailto:grub-devel-

Quoted 6 lines

[email protected]] On Behalf Of Robert Millan
Sent: Saturday, February 07, 2009 2:51 PM
To: The development of GRUB 2
Cc: Pavel Roskin; Jerone Young
Subject: Re: [PATCH] --build-id= none in newer ld versions PowerPC

Quoted 10 lines
Quoted 9 lines · Jerone Young

http://lists.gnu.org/archive/html/grub-devel/2008-12/msg00024.html

It is the attachment.

Quoted 3 lines · Pavel Roskin

Quoting Jerone Young <[email protected]>:

Did anyone have any objections to this patch. Not sure if anyone had

any

Quoted 13 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

craving to use --build-id. If not I'll check it in in the next week.

Where is the current version of the patch? Can we have a look first?

--
Regards,
Pavel Roskin

It seems nobody objected...

--
Robert Millan