Bug 1889516 - Missing DW_AT_declaration=1 in dwarf data
Summary: Missing DW_AT_declaration=1 in dwarf data
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1894002
TreeView+ depends on / blocked
 
Reported: 2020-10-19 20:09 UTC by Jiri Olsa
Modified: 2020-12-21 16:49 UTC (History)
18 users (show)

Fixed In Version: gcc-10.2.1-9.fc33 gcc-10.2.1-9.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1894002 (view as bug list)
Environment:
Last Closed: 2020-11-30 01:08:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jiri Olsa 2020-10-19 20:09:16 UTC
This bug was originally filled in:  
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97060

let's track it for fedora, because the affected gcc is now in fedora 32.

---
We are missing expected declaration tag - DW_AT_declaration : 1 for function
in debug info data.

The problem we see is:

 - fs/init.c calls vfs_getattr function
 - vfs_getattr is defined outside the fs/init.c
 - once compiled, debug info data for vfs_getattr should contain declaration
   tag - DW_AT_declaration : 1, but it's missing

gcc version: gcc (GCC) 10.2.1 20200826 (Red Hat 10.2.1-3)

Unfortunately the issue can be so far reproduced only inside container,
I tried to narrow it down to single fs/init.o object.

Following steps create fs/init.o binary in kernel tree within the container:

# podman image pull registry.gitlab.com/cki-project/containers/builder-rawhide:latest
# podman image list
# podman run -it <ID> /bin/bash
# git clone https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git --depth 1
# curl https://xci32.lab.eng.rdu2.redhat.com/cki-project/cki-pipeline/-/jobs/974002/artifacts/raw/artifacts/kernel-bpf-next-x86_64-cd04b04de119a222c83936f7e9dbd46a650cb688.config -o bpf-next/.config
# cd bpf-next/

# make oldconfig # might need some ENTERs
# make fs/ -j

# gcc -Wp,-MMD,fs/.init.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/10/include -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -fcf-protection=none -Wno-packed-not-aligned    -DKBUILD_MODFILE='"fs/init"' -DKBUILD_BASENAME='"init"' -DKBUILD_MODNAME='"init"' -c -o fs/init.o fs/init.c

# readelf --debug fs/init.o
...
 <1><9145>: Abbrev Number: 46 (DW_TAG_subprogram)
    <9146>   DW_AT_external    : 1
    <9146>   DW_AT_name        : (indirect string, offset: 0x531c): vfs_getattr
    <914a>   DW_AT_decl_file   : 7
    <914b>   DW_AT_decl_line   : 3148
    <914d>   DW_AT_decl_column : 12
    <914e>   DW_AT_prototyped  : 1
    <914e>   DW_AT_type        : <0xa9>
    <9152>   DW_AT_sibling     : <0x916b>
 <2><9156>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <9157>   DW_AT_type        : <0x3573>
 <2><915b>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <915c>   DW_AT_type        : <0x893a>
 <2><9160>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <9161>   DW_AT_type        : <0x111>
 <2><9165>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <9166>   DW_AT_type        : <0x4c>


When we link the final kernel binary the debug info data contains multiple records for vfs_getattr,
and neither has 'declaration' tag and it confuses pahole tool that uses this data to get function
records and skips declarations.

The problem is for more functions, vfs_getattr is just one example.

Comment 3 Jiri Olsa 2020-11-12 21:19:03 UTC
I saw some progress in upstream bug:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97060#c14

any idea when we could see fedora build with that fix?

thanks,
jirka

Comment 4 Jakub Jelinek 2020-11-12 21:58:21 UTC
https://koji.fedoraproject.org/koji/taskinfo?taskID=55446872
Not planning to build it in any other version yet until it is sufficiently verified.

Comment 5 Paulo Castro 2020-11-25 21:54:27 UTC
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97060 has been RESOLVED FIXED.

Comment 6 Fedora Update System 2020-11-27 09:52:49 UTC
FEDORA-2020-25659ed5b0 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-25659ed5b0

Comment 7 Fedora Update System 2020-11-27 09:54:11 UTC
FEDORA-2020-9e8ad5b507 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-9e8ad5b507

Comment 8 Fedora Update System 2020-11-28 02:55:30 UTC
FEDORA-2020-25659ed5b0 has been pushed to the Fedora 33 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-25659ed5b0`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-25659ed5b0

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2020-11-28 03:04:13 UTC
FEDORA-2020-9e8ad5b507 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-9e8ad5b507`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-9e8ad5b507

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2020-11-30 01:08:51 UTC
FEDORA-2020-25659ed5b0 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 Fedora Update System 2020-12-13 02:34:49 UTC
FEDORA-2020-9e8ad5b507 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.