This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix for unlikely text section grouping in conjunction with gcc's -ffunction-sections



Normally when GCC wants to emit an unlikely to be executed function, it'll put it in the .text.unlikely section.


However, when -ffunction-sections is enabled, the function will be placed into the .text.unlikely.<funcname> section. Thus .text.unlikely.* sections need to be handled in the ELF linker script.

At some point in the past, GCC used something like .text.name_unlikely, which was a horrible choice. I chose to keep that old style since we might be linking older objects with the older style name.

Note I didn't want to use .text.unlikely* as that would unfortunately match a function named "unlikely" when -ffunction-sections is active.

OK to install?


	* scripttempl/elf.sc: Handle function names and other
	text after .text.unlikely too.



diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index 318e054..e8126cb 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -470,7 +470,7 @@ cat <<EOF
   .text         ${RELOCATING-0} :
   {
     ${RELOCATING+${TEXT_START_SYMBOLS}}
-    ${RELOCATING+*(.text.unlikely .text.*_unlikely)}
+    ${RELOCATING+*(.text.unlikely .text.*_unlikely .text.unlikely.*)}
     ${RELOCATING+*(.text.exit .text.exit.*)}
     ${RELOCATING+*(.text.startup .text.startup.*)}
     ${RELOCATING+*(.text.hot .text.hot.*)}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]