-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues linking with relocations in a read-only section on Fedora 40 #37
Comments
Is there an option to get a plain GCC to emit this warning/error? I see lots of references to Red Hat specific spec files, so I'm just wondering how to reproduce it on my system. If you could provide the minimum extra |
I've also run into this issue. It seems to be the compiler trying to shed 'unused' symbols. I'm not 100% certain but the Line 62 in 61bf45c
Regardless, this command should recreate the issue locally: |
thanks folks! |
When building on Fedora, with it's various compiler flags for security, the linker complains about relocations in a read-only section:
gcc -Wall -Wextra -Werror -Wno-unused-parameter -I ../../include -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -o mdio mdio-bus.o mdio-main.o mdio-mdio.o mdio-mva.o mdio-mvls.o mdio-phy.o mdio-print_phy.o mdio-xrs.o -lmnl /usr/bin/ld: /tmp/ccyflkye.ltrans0.ltrans.o: warning: relocation against
__stop_cmds' in read-only section.text.startup' /usr/bin/ld: /tmp/ccyflkye.ltrans0.ltrans.o: in function
main':/home/perobins/rpmbuild/BUILD/mdio-tools-1.3.1/src/mdio/main.c:170:(.text.startup+0x14a): undefined reference to
__stop_cmds' /usr/bin/ld: /home/perobins/rpmbuild/BUILD/mdio-tools-1.3.1/src/mdio/main.c:170:(.text.startup+0x151): undefined reference to
__start_cmds'/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
`
The text was updated successfully, but these errors were encountered: