Skip to content
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

gcc version checks #246

Closed
goldyfruit opened this issue Jun 16, 2014 · 13 comments · Fixed by #286
Closed

gcc version checks #246

goldyfruit opened this issue Jun 16, 2014 · 13 comments · Fixed by #286

Comments

@goldyfruit
Copy link
Contributor

Hi,

I try to use kpatch on Debian GNU/Linux Wheezy with a 3.14.5 kernel. The kernel compilation works but when kpatch-build try to create the patch, it fail !

+ /usr/local/libexec/kpatch/create-diff-object orig/fs/proc/meminfo.o patched/fs/proc/meminfo.o /usr/lib/debug/lib/modules/3.14.5-kpatch/vmlinux output/fs/proc/meminfo.o
+ tee -a /tmp/kpatch-build-1402941756.log
meminfo.o: meminfo.o: changed section .rela.text not selected for inclusion
meminfo.o: meminfo.o: changed section .rodata.str1.8 not selected for inclusion
meminfo.o: 2 unsupported section change(s)
/usr/local/libexec/kpatch/create-diff-object: unreconcilable difference
+ [[ 2 -eq 0 ]]
+ die
+ [[ -z '' ]]
+ echo 'ERROR: kpatch build failed. Check /tmp/kpatch-build-1402941756.log for more details.'
ERROR: kpatch build failed. Check /tmp/kpatch-build-1402941756.log for more details.
+ exit 1
+ cleanup
+ [[ 1 -eq 0 ]]
+ [[ -e /media/.kpatch/src/applied-patch ]]

The command line used : kpatch-build -s /usr/src/linux-source-3.14.5-kpatch -c /boot/config-3.14.5-kpatch -d meminfo-string.patch

I found some discussions about .rela. issues but everytime it's fixed by a commit. I use the last kpatch version.

Thanks for your help.

@sjenning
Copy link
Contributor

@goldyfruit can you provide the patch you are using?

@goldyfruit
Copy link
Contributor Author

@Spartacus06 i use the patch in the example

--- linux-source-3.14/fs/proc/meminfo.c 2014-05-31 15:34:37.000000000 -0400
+++ meminfo.c   2014-06-12 14:24:48.301835424 -0400
@@ -131,7 +131,7 @@
                "Committed_AS:   %8lu kB\n"
                "VmallocTotal:   %8lu kB\n"
                "VmallocUsed:    %8lu kB\n"
-               "VmallocChunk:   %8lu kB\n"
+               "VMALLOCCHUNK:   %8lu kB\n"
 #ifdef CONFIG_MEMORY_FAILURE
                "HardwareCorrupted: %5lu kB\n"
 #endif

@jpoimboe
Copy link
Member

@goldyfruit This is a weird error, since kpatch-build should have no problem building this patch. Can you pull the latest master branch, recreate with the -d option added to kpatch-build, and put the resulting /tmp/kpatch-build-*.log file somewhere we can download it?

@flaming-toast
Copy link
Contributor

@goldyfruit What version of gcc are you using? I tried this on a vanilla Debian wheezy installation and was able to reproduce the error. Turns out that gcc 4.7.2 (the version of gcc bundled with wheezy) won't compile the changed objects with -ffunction-sections and -pg flags used together ("warning: -ffunction-sections disabled; it makes profiling impossible"). It's been noted as an issue (https://gcc.gnu.org/ml/gcc-help/2008-11/msg00128.html) and was patched in a later version of gcc. Updating gcc fixed the issue. kpatch-build should probably fail if that warning comes up :-) though I'm not sure how to force the build to fail for that particular warning.

@jpoimboe
Copy link
Member

Ah, thanks @goldyfruit . Maybe we can detect the gcc version and refuse to build on older versions.

@jpoimboe
Copy link
Member

Guess we need to update the README too, which says that "gcc >= 4.6" is supported.

@jpoimboe
Copy link
Member

sorry, thanks @flaming-toast :-)

@jpoimboe
Copy link
Member

Ideally we would also enforce that the gcc version is the same as the one used to build the original kernel, which should be pretty easy:

[master] ~/git/kpatch $ gcc --version |head -n1
gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7)
[master] ~/git/kpatch $ strings /usr/lib/debug/lib/modules/3.14.8-200.fc20.x86_64/vmlinux |grep "GCC:"
GCC: (GNU) 4.8.2 20131212 (Red Hat 4.8.2-7)

@flaming-toast
Copy link
Contributor

@jpoimboe Np. :-) Looks like the patch was merged in with the 4.8.0 release, so it should be safe to say something like "gcc >= 4.8"

@goldyfruit
Copy link
Contributor Author

@flaming-toast Yes, with GCC 4.8 it works !
@jpoimboe I think that it's a good thing to add a GCC check.

Thanks guys.

@jpoimboe
Copy link
Member

Reopening so we don't forget to add the gcc checks

@jpoimboe jpoimboe reopened this Jun 20, 2014
@jpoimboe jpoimboe changed the title changed section .rela.text not selected for inclusion gcc version checks Jun 20, 2014
@goldyfruit
Copy link
Contributor Author

@jpoimboe Right !

jpoimboe added a commit to jpoimboe/kpatch that referenced this issue Jul 1, 2014
Ensure the version of the locally installed gcc matches the one used to
compile the kernel, and is >= 4.8.

Fixes dynup#246.
@xdel
Copy link

xdel commented Jul 24, 2015

Just for search simplicity` sake, the necessary commit is gcc-mirror/gcc@e83660d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants