Re: [PATCH v4] perf: Add layout support for --symfs option

Namhyung Kim
2026-03-12T01:17:21Z

On Mon, Mar 09, 2026 at 05:44:12PM +0000, Changbin Du wrote:
> Add support for parsing an optional layout parameter in the --symfs
> command line option. The format is:
>
> --symfs <directory[,layout]>
>
> Where layout can be:
> - 'hierarchy': matches full path (default)
> - 'flat': only matches base name
>
> When debugging symbol files from a copy of the filesystem (e.g., from a
> container or remote machine), the debug files are often stored in a
> flat directory structure with only filenames, not the full original
> paths. In this case, using 'flat' layout allows perf to find debug
> symbols by matching only the filename rather than the full path.
>
> For example, given a binary path like:
> /build/output/lib/foo.so
>
> With 'perf report --symfs /debug/files,flat', perf will look for:
> /debug/files/foo.so
>
> Instead of:
> /debug/files/build/output/lib/foo.so
>
> This is particularly useful when:
> - Extracting debug files from containers with different directory layouts
> - Working with build systems that flatten directory structures
>
> Changes:
> - Add symfs_layout_flat field to symbol_conf struct.
> - Parse optional layout in symbol__config_symfs().
> - Modify __symbol__join_symfs() to use basename() when layout
> is 'flat'.
> - Update documentation in Documentation/ folder.
>
> Signed-off-by: Changbin Du <changbin.du@huawei.com>

Applied to perf-tools-next, thanks!

Best regards,
Namhyung