On Thu, Jun 18, 2020 at 01:37:46PM -0700, Matt Helsley wrote:
> recordmcount has its own ELF wrapper code and could utilize
> objtool's ELF code to more-portably handle architecture variations.
> This series makes recordmcount a subcommand of objtool. It very
> gradually convert
Rather than walk the section tables using the old recordmcount mapping
of the ELF file, walk the section list provided by objtool's ELF code.
This removes the last use of of the Elf_r_sym wrapper so we remove
that too.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c
-- the libelf/objtool
way and the old recordmcount wrapper way which avoids these
extra data structures by using indices, offsets, and pointers
into the mmapped ELF file.
Subsequent patches will convert from the old recordmcount
accessors to the libelf/objtool accessors.
Signed-off-by: Matt Helsley
the function to
something that reads more easily.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 2 +
tools/objtool/recordmcount.h | 94
2 files changed, 22 insertions(+), 74 deletions(-)
diff --git a/tools/objtool/recordmcount.c b/tools
ount relocation data and call instruction offsets.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 99 +++-
tools/objtool/recordmcount.h | 4 +-
2 files changed, 9 insertions(+), 94 deletions(-)
diff --git a/tools/objtool/recordmcount.c
Rather than allocating the ELF sections after collecting the
mcount locations and building the relocation entries, create
the empty sections beforehand. This has the benefit of
removing the memcpy() and just using the resulting libelf
buffers directly.
Signed-off-by: Matt Helsley
---
tools
Promote the now-bit-independent is_fake_mcount() out of the old
recordmcount ELF wrapper.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 48 +++---
tools/objtool/recordmcount.h | 50
2 files changed, 45 insertions
Use a new loc_size parameter to append_func() rather than
use the wrapper's _size macro directly.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 11 ++-
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/objtool/recordmcount.h b/tools/ob
h
clean up recordmcount to be more easily readable and remove
recordmcount's crude accessor wrapping code.
Signed-off-by: Matt Helsley
---
Documentation/dontdiff | 2 +-
Documentation/trace/ftrace.rst | 6 ++--
Makefile| 15 --
arch/arm64/include/as
Move recordmcount into the objtool directory. We keep this step separate
so changes which turn recordmcount into a subcommand of objtool don't
get obscured.
Signed-off-by: Matt Helsley
---
Documentation/trace/ftrace-design.rst | 4 ++--
Documentation/trace/ftrace.rst
Since it's no longer needed in the rest of do_func() we can move
it to where it's needed rather than pass it as a parameter.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/objtool/record
f the variable's type
inside the wrapper -- we can just use a regular int.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 11 ---
tools/objtool/recordmcount.h | 5 -
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/objtool/recordmcount.c b/too
calls and those
will get replaced later.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 9 -
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h
index eed592954f37..19bff5a7c8ce 100644
--- a/tools/ob
Setting altmcount only when processing ARM ELF files is
not necessary -- we can make the code easier to read
by always checking for the string.
Signed-off-by: Matt Helsley
---
tools/objtool/mcount.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/objtool/mcount.c b
't use the
recordmcount wrapper. The next patch will move it out of the
wrapper.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 44 +++--
tools/objtool/recordmcount.h | 122 ++-
2 files changed, 60 insertions(+), 106 deletions(-)
diff --git
Since the relocation section's sh_info points back to the text
section it applies to and we already have that we can just pass
it in and greatly simplify find_section_sym_index().
Signed-off-by: Matt Helsley
---
tools/objtool/mcount.c | 39 +++
1 file ch
objtool
struct symbol which callers can use as-needed.
Reported-by: Kamalesh Babulal
Signed-off-by: Matt Helsley
Co-developed-by: Kamalesh Babulal
Co-developed-by: Peter Zijlstra
--
Thanks to Kamalesh Babulal for reporting this problem and suggesting
a fix. Thanks to Peter Zijlstra for
Rather than use the size of the relocations check the section
header type directly to see if the mcount relocations should
be rel or rela relocations.
Signed-off-by: Matt Helsley
---
tools/objtool/elf.c| 4 ++--
tools/objtool/elf.h| 2 +-
tools/objtool/mcount.c | 15 +--
3
data.
Signed-off-by: Matt Helsley
---
tools/objtool/elf.c| 16
tools/objtool/elf.h| 2 +-
tools/objtool/mcount.c | 36 +++-
3 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
Now that it's been stripped of using the old recordmcount ELF
wrapper get_mcountsym() is ready to be promoted out of the
double-included wrapper header.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 16
tools/objtool/recordmcount.h | 19 -
-by: Matt Helsley
---
tools/objtool/elf.c | 3 +-
tools/objtool/elf.h | 1 +
tools/objtool/recordmcount.c | 2 +-
tools/objtool/recordmcount.h | 89 ++--
4 files changed, 37 insertions(+), 58 deletions(-)
diff --git a/tools/objtool/elf.c b/tools
Remove gpfx -- the recognized prefix for the mcount symbol
-- and just recognize any of the prefixes. This allows us
to further substitute the various strings directly into the
code rather than using variables.
Signed-off-by: Matt Helsley
---
tools/objtool/mcount.c | 19 ---
1
The comments at the top no longer reflect how we process the ELF
contents. More helpful comments are inline with the code so we
don't need the top comments either.
Signed-off-by: Matt Helsley
---
tools/objtool/mcount.c | 13 -
1 file changed, 13 deletions(-)
diff --git a/
Now that they're no longer used we can remove these endian
wrappers.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 63
1 file changed, 63 deletions(-)
diff --git a/tools/objtool/recordmcount.c b/tools/objtool/recordmcount.c
Move the check for relocations sections that apply to
mcountable text sections into objtool's ELF code.
Signed-off-by: Matt Helsley
---
tools/objtool/elf.c| 13 +
tools/objtool/elf.h| 2 +-
tools/objtool/mcount.c | 36
3 files ch
Suggested-by: Peter Zijlstra
Signed-off-by: Matt Helsley
---
tools/objtool/check.c | 3 +--
tools/objtool/elf.c | 7 +++
tools/objtool/elf.h | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 78375908acda
Remove the last uses of the Elf_Rela wrapper by passing the
size of the relocations we're dealing with as a parameter.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 4 ++--
tools/objtool/recordmcount.h | 7 ++-
2 files changed, 4 insertions(+), 7 deletions(-)
diff --
eeded
for individual subcommands. Finally, if we manage to combine
subcommands into a single exec of objtool the number of
passes through the ELF data could be even further reduced.
Suggested-by: Peter Zijlstra
Signed-off-by: Matt Helsley
---
tools/objtool/elf.c| 18 ++
pping the wrapped naming.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 113 --
tools/objtool/recordmcount.h | 132 ---
2 files changed, 107 insertions(+), 138 deletions(-)
delete mode 100644 tools/objtool/recordmcount.h
Signed-off-by: Matt Helsley
---
tools/objtool/mcount.c | 42 +-
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/tools/objtool/mcount.c b/tools/objtool/mcount.c
index 5c59df0df97b..629eb7222ef3 100644
--- a/tools/objtool/mcount.c
+++ b/tools/o
difference
between this and the old recordmcount code is we didn't set
SHF_INFO_LINK so we clear the sh_flags as before.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 18 +-
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/tools/objtool/recordmco
Determine the size of the mcount relocations in objtool's
ELF reading code. This reduces the number of passes we make
through the list of sections (which can become large due to
things like -ffunction-sections).
Signed-off-by: Matt Helsley
---
tools/objtool/elf.c| 2 ++
tools/objtool/
The ELF header is the very first structure in an ELF file.
Rather than cast it from the file mapping we use the ELF
header extracted via objtool's ELF code.
This is the last usage of the open-coded mapping of the ELF
file which we will remove in a later step.
Signed-off-by: Matt He
objtool's elf_write_insn() does extra checking when writing to
an instruction so use that rather than a plain memcpy().
Signed-off-by: Matt Helsley
---
tools/objtool/mcount.c | 10 --
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/tools/objtool/mcount.c b/tools/ob
One flag is only for relocation sections and the other only
for text (not relocation) sections so we can share the same
flag and test the section type when we need to.
Signed-off-by: Matt Helsley
---
tools/objtool/elf.c| 5 ++---
tools/objtool/elf.h| 2 +-
tools/objtool/mcount.c | 9
Now that this function no longer uses any of the old recordmcount
wrapper code we can move it out of the wrapper too.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 47 +
tools/objtool/recordmcount.h | 50
2
ively.
Signed-off-by: Matt Helsley
---
tools/objtool/mcount.c | 133 +++--
1 file changed, 75 insertions(+), 58 deletions(-)
diff --git a/tools/objtool/mcount.c b/tools/objtool/mcount.c
index 7fbde6ce6eb8..7d7843f7cd44 100644
--- a/tools/objtool/mcount.c
+++ b/
Now that we've converted recordmcount to a subcommand of objtool
rename the .c file in order to follow the convention of the other
objtool subcmds.
Signed-off-by: Matt Helsley
---
tools/objtool/Build| 2 +-
tools/objtool/{recordmcount.c => mcount.c} | 0
2 files
Instead of hard-coding what amounts to a memcmp() use memcmp to
determine if the instruction we wish to replace matches what we
expect. This makes the x86 code more like that of, for instance,
ARM.
Signed-off-by: Matt Helsley
---
tools/objtool/mcount.c | 19 ++-
1 file changed
The name of the object file being processed is unused in
the wrapper's leaf functions so we no longer need to pass
it as a parameter.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 4 ++--
tools/objtool/recordmcount.h | 19 ---
2 files changed, 10 inser
ffset as separate parameters.
Note that this patch does not move the associated parts out
of the wrapper file. We postpone that cleanup for later so that
it's easier to see the changes to the functions rather than
obscuring them with the move.
Signed-off-by: Matt Hel
The has_rel_mcount() and tot_relsize() helpers are no longer
dependent on the ELF wrapper so we can move them.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 26 ++
tools/objtool/recordmcount.h | 33 -
2 files changed, 26
if they should be turned
into no-ops, then calling the arch-specific code. Since none of
these use the recordmcount ELF wrappers anymore we can move it out
of the wrapper.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 47 +
tools/objtool
Replace MIPS is_fake_mcount code using Elf_Addr with
unsigned long for the offsets. This is consistent with the way
that objtool more generally treats offsets and removes the
last use of the Elf_Addr wrapper.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 9 +++--
1 file
Move where we detect the size of relocation entries we wish to
use into the first loop over the sections. This will allow us
to allocate the mcount location and relocation sections before
the next loop that collects them.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 8
Since we're no longer writing to the ELF file mapping and we're
not appending to it we don't need to keep more information from the
stat structure. At the same time we can give the smaller global
variable a better name.
Signed-off-by: Matt Helsley
---
tools/objtool/rec
We can use the objtool GElf_Ehdr structure to access ehdr here.
This makes the function completely independent of the old
recordmcount ELF wrapper. The next step will be to promote it
to the C file.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 13 ++---
1 file changed
This function is no longer dependent upon the old recordmcount
ELF wrapper code -- it doesn't use the wrapper's Elf_* types nor
does it call wrapped functions. Move it into the C file.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 42 +
Rather than open coding symbol name lookups in get_sym_and_*()
we rename the structure and use objtool's lookup function to
get the symbol name for a relocation. We also change the name
of the function to better reflect its purpose.
Signed-off-by: Matt Helsley
---
tools/objtool/
ready_has_rel_mcount string
pointer trick.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 4
tools/objtool/recordmcount.h | 17 +++--
2 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/tools/objtool/recordmcount.c b/tools/objtool/recordmcount.
lf/objtool to modify the ELF
file -- it only changes the way we walk the ELF sections and do
lookups to find the relocations.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 61 +++-
1 file changed, 32 insertions(+), 29 deletions(-)
diff --git a/too
bunch of
per-supported-arch ifdef blocks in tools/objtool/Makefile.
Signed-off-by: Matt Helsley
---
Makefile | 15 ---
arch/Kconfig | 23 +++
arch/x86/Kconfig.debug | 1 +
lib/Kconfig.debug | 1 +
tools/objtool/Makefile | 5 +++--
5
al.home/
[6] https://lore.kernel.org/lkml/cover.1586468801.git.mhels...@vmware.com/
Matt Helsley (51):
objtool: Factor out reasons to build objtool
objtool: Prepare to merge recordmcount
objtool: Make recordmcount into mcount subcmd
objtool: recordmcount: Start using objtool's elf wr
On Fri, Jun 12, 2020 at 06:05:34PM +0200, Peter Zijlstra wrote:
> On Fri, Jun 12, 2020 at 03:26:57PM +0200, Peter Zijlstra wrote:
> > On Tue, Jun 02, 2020 at 12:50:11PM -0700, Matt Helsley wrote:
> > > +static int nop_mcount(struct section * const rels,
> > > +
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: f1974222634010486c1692e843af0ab11304dd2c
Gitweb:
https://git.kernel.org/tip/f1974222634010486c1692e843af0ab11304dd2c
Author:Matt Helsley
AuthorDate:Fri, 29 May 2020 14:01:13 -07:00
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: fb414783b65c880606fbc1463e6849f017e60d46
Gitweb:
https://git.kernel.org/tip/fb414783b65c880606fbc1463e6849f017e60d46
Author:Matt Helsley
AuthorDate:Fri, 29 May 2020 14:01:14 -07:00
return 0;
> > +}
>
> Doing the change Matt asked for #1, I realized that sec->changed is only
> required if we need to rewrite the section header, neither of these two
> changes requires that, they already mark the elf data dirty so
> elf_update() DTRT.
This is really useful information.
As long as you're adding the elf->changed flag it might make sense to add this
as a comment in the struct section definition or even rename sec->changed
to reflect this (e.g. sec->shdr_changed).
Cheers,
-Matt Helsley
On Fri, Jun 12, 2020 at 04:30:35PM +0200, Peter Zijlstra wrote:
> With there being multiple ways to change the ELF data, let's more
> concisely track modification.
>
> Signed-off-by: Peter Zijlstra (Intel)
Would it make sense to set the relocation section's "changed" flag in
addition to the elf
into NOPs, similar to what recordmcount does.
>
> I'm hoping the pending objtool-recordmcount patches can also reuse some of
> this.
This sounds great to me -- I'll have a look through your series and will try
rebasing my work on this.
Cheers,
-Matt Helsley
On Fri, Jun 12, 2020 at 03:26:56PM +0200, Peter Zijlstra wrote:
> On Tue, Jun 02, 2020 at 12:50:11PM -0700, Matt Helsley wrote:
> > +static int nop_mcount(struct section * const rels,
> > + const char *const txtname)
> > +{
> > + struct reloc *reloc;
&
nly the appropriate processes retain the pidfd.
4. The parent can then pass the *reserved* pidfd into clone3(). The
reserved pidfd seamlessly turns into a pidfd reference to the child if
clone3() succeeds. If it fails the eservation is still consumed -- a
given pidfd reserved for clone3() can only be passed to clone3() and
succeed once.
Perhaps this scheme could concentrate the need for CAP_SYS_ADMIN
to one process so maybe it would obviate the need for CAP_RESTORE.
That said, perhaps there's something that prevents implementing such
a pidfd or perhaps I have misunderstood what CRIU is doing and this
pidfd idea isn't workable.
Cheers,
-Matt Helsley
On Tue, Jun 09, 2020 at 02:52:07PM -0400, Steven Rostedt wrote:
> On Tue, 9 Jun 2020 11:39:51 -0700
> Matt Helsley wrote:
>
> > > > +ifeq ($(SRCARCH),sparc)
> > > > + SUBCMD_MCOUNT := y
> > >
> > > Is there some arch for which MC
On Tue, Jun 09, 2020 at 10:00:59AM +0100, Julien Thierry wrote:
> Hi Matt,
>
> On 6/2/20 8:49 PM, Matt Helsley wrote:
> > Rather than a standalone executable merge recordmcount as a sub command
> > of objtool. This is a small step towards cleaning up recordmcount and
> &
On Tue, Jun 09, 2020 at 12:11:55PM +0530, Kamalesh Babulal wrote:
> On 6/3/20 1:20 AM, Matt Helsley wrote:
> > Rather than building the exact ELF section data we need and
> > avoiding libelf's conversion step, use more GElf types
> > and then libelf's elfxx_xlatetof
On Tue, Jun 09, 2020 at 09:54:33AM +0100, Julien Thierry wrote:
> Hi Matt,
>
> On 6/2/20 8:49 PM, Matt Helsley wrote:
> > Move recordmcount into the objtool directory. We keep this step separate
> > so changes which turn recordmcount into a subcommand of objtool d
On Mon, Jun 08, 2020 at 08:12:01AM +0100, Julien Thierry wrote:
> Now that the objtool_file can be obtained outside of the check function,
> orc generation builtin no longer requires check to explicitly call its
> orc related functions.
>
> Signed-off-by: Julien Thierry
Re
check to do the correct setup for them and
> explicitly hand the objtool_file to them.
>
> Signed-off-by: Julien Thierry
Reviewed-by: Matt Helsley
> ---
> tools/objtool/builtin-check.c | 7 ++-
> tools/objtool/builtin-orc.c | 8 +++-
>
Remove the last use of the Elf_Rela wrapper by passing the
size of the relocations we're dealing with as a parameter.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 4 ++--
tools/objtool/recordmcount.h | 7 ++-
2 files changed, 4 insertions(+), 7 deletions(-)
diff --
ready_has_rel_mcount string
pointer trick.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 4
tools/objtool/recordmcount.h | 17 +++--
2 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/tools/objtool/recordmcount.c b/tools/objtool/recordmcount.
h
clean up recordmcount to be more easily readable and remove
recordmcount's crude accessor wrapping code.
Signed-off-by: Matt Helsley
---
Documentation/dontdiff | 2 +-
Documentation/trace/ftrace.rst | 6 ++--
Makefile| 9 --
arch/arm64/include/as
Now that this function no longer uses any of the old recordmcount
wrapper code we can move it out of the wrapper too.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 47 +
tools/objtool/recordmcount.h | 50
2
Now that we've converted recordmcount to a subcommand of objtool
rename the .c file in order to follow the convention of the other
objtool subcmds.
Signed-off-by: Matt Helsley
---
tools/objtool/Build| 2 +-
tools/objtool/{recordmcount.c => mcount.c} | 0
2 files
Now that they're no longer used we can remove these endian
wrappers.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 63
1 file changed, 63 deletions(-)
diff --git a/tools/objtool/recordmcount.c b/tools/objtool/recordmcount.c
't use the
recordmcount wrapper. The next patch will move it out of the
wrapper.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 44 +++--
tools/objtool/recordmcount.h | 120 ++-
2 files changed, 59 insertions(+), 105 deletions(-)
diff --git
The name of the object file being processed is unused in
the wrapper's leaf functions so we no longer need to pass
it as a parameter.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 4 ++--
tools/objtool/recordmcount.h | 19 ---
2 files changed, 10 inser
Rather than using indices into raw ELF32/64 tables mapped for the
wrapper, use the objtool functions to find the a suitable symbol
in the given text section.
Also take advantage of this commit to rename the function to
something that reads more easily.
Signed-off-by: Matt Helsley
---
tools
Promote the now-bit-independent is_fake_mcount() out of the old
recordmcount ELF wrapper.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 48 +++---
tools/objtool/recordmcount.h | 50
2 files changed, 45 insertions
lf/objtool to modify the ELF
file -- it only changes the way we walk the ELF sections and do
lookups to find the relocations.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 62 +++-
1 file changed, 32 insertions(+), 30 deletions(-)
diff --git a/too
if they should be turned
into no-ops, then calling the arch-specific code. Since none of
these use the recordmcount ELF wrappers anymore we can move it out
of the wrapper.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 47 +
tools/objtool
Replace MIPS is_fake_mcount code using Elf_Addr with
unsigned long for the offsets. This is consistent with the way
that objtool more generally treats offsets and removes the
last use of the Elf_Addr wrapper.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 9 +++--
1 file
see the changes to the functions rather than
obscuring them with the move.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 161 ---
tools/objtool/recordmcount.h | 132 +---
2 files changed, 55 insertions(+), 238 deletions(-)
diff
Since we're no longer writing to the ELF file mapping and we're
not appending to it we don't need to keep more information from the
stat structure. At the same time we can give the smaller global
variable a better name.
Signed-off-by: Matt Helsley
---
tools/objtool/rec
Rather than walk the section tables using the old recordmcount mapping
of the ELF file, walk the section list provided by objtool's ELF code.
This removes the last use of of the Elf_r_sym wrapper so we remove
that too.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c
ount relocation data and call instruction offsets.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 99 +++-
tools/objtool/recordmcount.h | 4 +-
2 files changed, 9 insertions(+), 94 deletions(-)
diff --git a/tools/objtool/recordmcount.c
The has_rel_mcount() and tot_relsize() helpers are no longer
dependent on the ELF wrapper so we can move them.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 25 +
tools/objtool/recordmcount.h | 33 -
2 files changed, 25
Rather than open coding symbol name lookups in get_sym_and_*()
we rename the structure and use objtool's lookup function to
get the symbol name for a relocation. We also change the name
of the function to better reflect its purpose.
Signed-off-by: Matt Helsley
---
tools/objtool/
Use a new loc_size parameter to append_func() rather than
use the wrapper's _size macro directly.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 9 +
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmco
f the variable's type
inside the wrapper -- we can just use a regular int.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 12 +---
tools/objtool/recordmcount.h | 5 -
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/tools/objtool/recordmcount.c b/too
This function is no longer dependent upon the old recordmcount
ELF wrapper code -- it doesn't use the wrapper's Elf_* types nor
does it call wrapped functions. Move it into the C file.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 41 +
Move where we detect the size of relocation entries we wish to
use into the first loop over the sections. This will allow us
to allocate the mcount location and relocation sections before
the next loop that collects them.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 8
We can use the objtool GElf_Ehdr structure to access ehdr here.
This makes the function completely independent of the old
recordmcount ELF wrapper. The next step will be to promote it
to the C file.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 13 ++---
1 file changed
Now that it's been stripped of using the old recordmcount ELF
wrapper get_mcountsym() is ready to be promoted out of the
double-included wrapper header.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 16
tools/objtool/recordmcount.h | 19 -
calls and those will get
replaced later.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h
index 98cf9eea6074..7ebc617fb3a6 100644
--- a/tools/ob
Rather than allocating the ELF sections after collecting the
mcount locations and building the relocation entries, create
the empty sections beforehand. This has the benefit of
removing the memcpy() and just using the resulting libgelf
buffers directly.
Signed-off-by: Matt Helsley
---
tools
The ELF header is the very first structure in an ELF file.
Rather than cast it from the file mapping we use the ELF
header extracted via objtool's ELF code.
This is the last usage of the open-coded mapping of the ELF
file which we will remove in a later step.
Signed-off-by: Matt He
pping the wrapped naming.
Signed-off-by: Matt Helsley
---
tools/objtool/recordmcount.c | 122 --
tools/objtool/recordmcount.h | 142 ---
2 files changed, 116 insertions(+), 148 deletions(-)
delete mode 100644 tools/objtool/recordmcount.h
er
Rebased to latest mainline -rc
Matt Helsley (32):
objtool: Prepare to merge recordmcount
objtool: Make recordmcount into mcount subcmd
objtool: recordmcount: Start using objtool's elf wrapper
objtool: recordmcount: Search for __mcount_loc before walking the
sectio
-- the libelf/objtool
way and the old recordmcount wrapper way which avoids these
extra data structures by using indices, offsets, and pointers
into the mmapped ELF file.
Subsequent patches will convert from the old recordmcount
accessors to the libelf/objtool accessors.
Signed-off-by: Matt Helsley
Move recordmcount into the objtool directory. We keep this step separate
so changes which turn recordmcount into a subcommand of objtool don't
get obscured.
Signed-off-by: Matt Helsley
---
Documentation/trace/ftrace-design.rst | 4 ++--
Documentation/trace/ftrace.rst
-by: Matt Helsley
---
tools/objtool/elf.c | 3 +-
tools/objtool/elf.h | 1 +
tools/objtool/recordmcount.c | 2 +-
tools/objtool/recordmcount.h | 89 ++--
4 files changed, 37 insertions(+), 58 deletions(-)
diff --git a/tools/objtool/elf.c b/tools
1 - 100 of 255 matches
Mail list logo