d5ab2bc3 | 11-Mar-2024 |
Tiezhu Yang <yangtiezhu@loongson.cn> |
objtool: Check local label in add_dead_ends()
When update the latest upstream gcc and binutils, it generates more objtool warnings on LoongArch, like this:
init/main.o: warning: objtool: unexpect
objtool: Check local label in add_dead_ends()
When update the latest upstream gcc and binutils, it generates more objtool warnings on LoongArch, like this:
init/main.o: warning: objtool: unexpected relocation symbol type in .rela.discard.unreachable
We can see that the reloc sym name is local label instead of section in relocation section '.rela.discard.unreachable', in this case, the reloc sym type is STT_NOTYPE instead of STT_SECTION.
As suggested by Peter Zijlstra, we add a "local_label" member in struct symbol, then set it as true if symbol type is STT_NOTYPE and symbol name starts with ".L" string in classify_symbols().
Let's check reloc->sym->local_label to not return -1 in add_dead_ends(), and also use reloc->sym->offset instead of reloc addend which is 0 to find the corresponding instruction. At the same time, let's replace the variable "addend" with "offset" to reflect the reality.
Here are some detailed info: [fedora@linux 6.8.test]$ gcc --version gcc (GCC) 14.0.1 20240129 (experimental) [fedora@linux 6.8.test]$ as --version GNU assembler (GNU Binutils) 2.42.50.20240129 [fedora@linux 6.8.test]$ readelf -r init/main.o | grep -A 2 "rela.discard.unreachable" Relocation section '.rela.discard.unreachable' at offset 0x6028 contains 1 entry: Offset Info Type Sym. Value Sym. Name + Addend 000000000000 00d900000063 R_LARCH_32_PCREL 00000000000002c4 .L500^B1 + 0
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
show more ...
|
ec24b927 | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Get rid of reloc->rel[a]
Get the relocation entry info from the underlying rsec->data.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 35.12G - After: peak
objtool: Get rid of reloc->rel[a]
Get the relocation entry info from the underlying rsec->data.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 35.12G - After: peak heap memory consumption: 29.93G
Link: https://lore.kernel.org/r/2be32323de6d8cc73179ee0ff14b71f4e7cefaa0.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
02b54001 | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Shrink elf hash nodes
Instead of using hlist for the 'struct elf' hashes, use a custom single-linked list scheme.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consump
objtool: Shrink elf hash nodes
Instead of using hlist for the 'struct elf' hashes, use a custom single-linked list scheme.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 36.89G - After: peak heap memory consumption: 35.12G
Link: https://lore.kernel.org/r/6e8cd305ed22e743c30d6e72cfdc1be20fb94cd4.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
890f10a4 | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Shrink reloc->sym_reloc_entry
Convert it to a singly-linked list.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 38.64G - After: peak heap memory consumpt
objtool: Shrink reloc->sym_reloc_entry
Convert it to a singly-linked list.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 38.64G - After: peak heap memory consumption: 36.89G
Link: https://lore.kernel.org/r/a51f0a6f9bbf2494d5a3a449807307e78a940988.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
be2f0b1e | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Get rid of reloc->jump_table_start
Rework the jump table logic slightly so 'jump_table_start' is no longer needed.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consum
objtool: Get rid of reloc->jump_table_start
Rework the jump table logic slightly so 'jump_table_start' is no longer needed.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 40.37G - After: peak heap memory consumption: 38.64G
Link: https://lore.kernel.org/r/e1602ed8a6171ada3cfac0bd8449892ec82bd188.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
e4cbb9b8 | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Get rid of reloc->offset
Get the offset from the embedded GElf_Rel[a] struct.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 43.83G - After: peak heap mem
objtool: Get rid of reloc->offset
Get the offset from the embedded GElf_Rel[a] struct.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 43.83G - After: peak heap memory consumption: 42.10G
Link: https://lore.kernel.org/r/2b9ec01178baa346a99522710bf2e82159412e3a.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
be9a4c11 | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Get rid of reloc->idx
Use the array offset to calculate the reloc index.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 45.56G - After: peak heap memory c
objtool: Get rid of reloc->idx
Use the array offset to calculate the reloc index.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 45.56G - After: peak heap memory consumption: 43.83G
Link: https://lore.kernel.org/r/7351d2ebad0519027db14a32f6204af84952574a.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
ebcef730 | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Get rid of reloc->list
Now that all relocs are allocated in an array, the linked list is no longer needed.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 4
objtool: Get rid of reloc->list
Now that all relocs are allocated in an array, the linked list is no longer needed.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 49.02G - After: peak heap memory consumption: 45.56G
Link: https://lore.kernel.org/r/71e7a2c017dbc46bb497857ec97d67214f832d10.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
6342a20e | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Add elf_create_section_pair()
When creating an annotation section, allocate the reloc section data at the beginning. This simplifies the data model a bit and also saves memory due to the r
objtool: Add elf_create_section_pair()
When creating an annotation section, allocate the reloc section data at the beginning. This simplifies the data model a bit and also saves memory due to the removal of malloc() in elf_rebuild_reloc_section().
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 53.49G - After: peak heap memory consumption: 49.02G
Link: https://lore.kernel.org/r/048e908f3ede9b66c15e44672b6dda992b1dae3e.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
ff408273 | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Add mark_sec_changed()
Ensure elf->changed always gets set when sec->changed gets set.
Link: https://lore.kernel.org/r/9a810a8d2e28af6ba07325362d0eb4703bb09d3a.1685464332.git.jpoimboe@kern
objtool: Add mark_sec_changed()
Ensure elf->changed always gets set when sec->changed gets set.
Link: https://lore.kernel.org/r/9a810a8d2e28af6ba07325362d0eb4703bb09d3a.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
eb0481bb | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Fix reloc_hash size
With CONFIG_DEBUG_INFO, DWARF creates a lot of relocations and reloc_hash is woefully undersized, which can affect performance significantly. Fix that.
Link: https://l
objtool: Fix reloc_hash size
With CONFIG_DEBUG_INFO, DWARF creates a lot of relocations and reloc_hash is woefully undersized, which can affect performance significantly. Fix that.
Link: https://lore.kernel.org/r/38ef60dc8043270bf3b9dfd139ae2a30ca3f75cc.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
53257a97 | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Consolidate rel/rela handling
The GElf_Rel[a] structs have more similarities than differences. It's safe to hard-code the assumptions about their shared fields as they will never change.
objtool: Consolidate rel/rela handling
The GElf_Rel[a] structs have more similarities than differences. It's safe to hard-code the assumptions about their shared fields as they will never change. Consolidate their handling where possible, getting rid of duplicated code.
Also, at least for now we only ever create rela sections, so simplify the relocation creation code to be rela-only.
Link: https://lore.kernel.org/r/dcabf6df400ca500ea929f1e4284f5e5ec0b27c8.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
a5bd6236 | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Improve reloc naming
- The term "reloc" is overloaded to mean both "an instance of struct reloc" and "a reloc section". Change the latter to "rsec".
- For variable names, use "sec" for
objtool: Improve reloc naming
- The term "reloc" is overloaded to mean both "an instance of struct reloc" and "a reloc section". Change the latter to "rsec".
- For variable names, use "sec" for regular sections and "rsec" for rela sections to prevent them getting mixed up.
- For struct reloc variables, use "reloc" instead of "rel" everywhere for consistency.
Link: https://lore.kernel.org/r/8b790e403df46f445c21003e7893b8f53b99a6f3.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
2707579d | 30-May-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Remove flags argument from elf_create_section()
Simplify the elf_create_section() interface a bit by removing the flags argument. Most callers don't care about changing the section header
objtool: Remove flags argument from elf_create_section()
Simplify the elf_create_section() interface a bit by removing the flags argument. Most callers don't care about changing the section header flags. If needed, they can be modified afterwards, just like any other section header field.
Link: https://lore.kernel.org/r/515235d9cf62637a14bee37bfa9169ef20065471.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
ced23d2e | 18-Apr-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Include backtrace in verbose mode
Include backtrace in verbose mode. This makes it easy to gather all the information needed for diagnosing objtool warnings.
Reviewed-by: Miroslav Benes <
objtool: Include backtrace in verbose mode
Include backtrace in verbose mode. This makes it easy to gather all the information needed for diagnosing objtool warnings.
Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lore.kernel.org/r/c255224fabcf7e64bac232fec1c77c9fc2d7d7ab.1681853186.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|
ca653464 | 18-Apr-2023 |
Josh Poimboeuf <jpoimboe@kernel.org> |
objtool: Add verbose option for disassembling affected functions
When a warning is associated with a function, add an option to disassemble that function.
This makes it easier for reporters to subm
objtool: Add verbose option for disassembling affected functions
When a warning is associated with a function, add an option to disassemble that function.
This makes it easier for reporters to submit the information needed to diagnose objtool warnings.
Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lore.kernel.org/r/dd0fe13428ede186f09c74059a8001f4adcea5fc.1681853186.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
show more ...
|