Created attachment 38182 [details] Only include sources for the appropriate platform Currently valgrind always compiles and builds into coregrind the assembly files for every supported platform. The sources themselves have ifdefs in them to include only code for the current platform. The empty object files created do not have the section notes to let the linker know executable stacks are not required, which is causing some QA checks in our distribution to fail. The attached patch puts the responsibility of selecting the right assembly sources in the makefiles and removes the ifdefs from the sources themselves, so a scanelf -qeR run in the coregrind directory after building valgrind does not issue any warnings anymore.
I recently changed the build system so that all files are included in the build, specifically because it simplifies the build system greatly. I'd rather not re-introduce conditional compilation stuff. What would the section notes to the linker look like?
They are just missing in those empty object files. For ppc64-aix5 for instance the section notes are not in the source file (I assume because it is not normally assembled with gnu as) and for x86-linux it is excluded by the #ifdef when building on amd64. > scanelf -qeR . !WX --- --- ./libcoregrind_amd64_linux_a-syscall-ppc64-aix5.o !WX --- --- ./libcoregrind_amd64_linux_a-syscall-amd64-darwin.o !WX --- --- ./libcoregrind_amd64_linux_a-m_start-amd64-darwin.o !WX --- --- ./libcoregrind_amd64_linux_a-dispatch-ppc64-aix5.o !WX --- --- ./libcoregrind_x86_linux_a-syscall-x86-darwin.o !WX --- --- ./libcoregrind_amd64_linux_a-mach_traps-amd64-darwin.o !WX --- --- ./libcoregrind_x86_linux_a-dispatch-amd64-darwin.o !WX --- --- ./libcoregrind_x86_linux_a-syscall-amd64-darwin.o !WX --- --- ./libcoregrind_x86_linux_a-syscall-amd64-linux.o !WX --- --- ./libcoregrind_x86_linux_a-dispatch-x86-darwin.o !WX --- --- ./libcoregrind_x86_linux_a-dispatch-ppc64-aix5.o !WX --- --- ./libcoregrind_amd64_linux_a-syscall-x86-darwin.o !WX --- --- ./libcoregrind_amd64_linux_a-dispatch-ppc32-aix5.o !WX --- --- ./libcoregrind_x86_linux_a-m_start-amd64-darwin.o !WX --- --- ./libcoregrind_x86_linux_a-mach_traps-x86-darwin.o !WX --- --- ./libcoregrind_amd64_linux_a-syscall-ppc32-linux.o !WX --- --- ./libcoregrind_x86_linux_a-m_start-x86-darwin.o !WX --- --- ./libcoregrind_x86_linux_a-mach_traps-amd64-darwin.o !WX --- --- ./libcoregrind_amd64_linux_a-syscall-x86-linux.o !WX --- --- ./libcoregrind_amd64_linux_a-syscall-ppc32-aix5.o !WX --- --- ./libcoregrind_x86_linux_a-syscall-ppc64-aix5.o !WX --- --- ./libcoregrind_amd64_linux_a-m_start-x86-darwin.o !WX --- --- ./libcoregrind_amd64_linux_a-dispatch-x86-darwin.o !WX --- --- ./libcoregrind_x86_linux_a-dispatch-ppc32-aix5.o !WX --- --- ./libcoregrind_amd64_linux_a-dispatch-x86-linux.o !WX --- --- ./libcoregrind_x86_linux_a-dispatch-ppc64-linux.o !WX --- --- ./libcoregrind_x86_linux_a-syscall-ppc32-aix5.o !WX --- --- ./libcoregrind_x86_linux_a-dispatch-amd64-linux.o !WX --- --- ./libcoregrind_amd64_linux_a-mach_traps-x86-darwin.o !WX --- --- ./libcoregrind_amd64_linux_a-dispatch-ppc32-linux.o !WX --- --- ./libcoregrind_amd64_linux_a-dispatch-amd64-darwin.o !WX --- --- ./libcoregrind_amd64_linux_a-dispatch-ppc64-linux.o !WX --- --- ./libcoregrind_x86_linux_a-syscall-ppc32-linux.o !WX --- --- ./libcoregrind_amd64_linux_a-syscall-ppc64-linux.o !WX --- --- ./libcoregrind_x86_linux_a-dispatch-ppc32-linux.o !WX --- --- ./libcoregrind_x86_linux_a-syscall-ppc64-linux.o > readelf -S ./libcoregrind_amd64_linux_a-syscall-ppc64-aix5.o There are 7 section headers, starting at offset 0x70: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .text PROGBITS 0000000000000000 00000040 0000000000000000 0000000000000000 AX 0 0 4 [ 2] .data PROGBITS 0000000000000000 00000040 0000000000000000 0000000000000000 WA 0 0 4 [ 3] .bss NOBITS 0000000000000000 00000040 0000000000000000 0000000000000000 WA 0 0 4 [ 4] .shstrtab STRTAB 0000000000000000 00000040 000000000000002c 0000000000000000 0 0 1 [ 5] .symtab SYMTAB 0000000000000000 00000230 0000000000000060 0000000000000018 6 4 8 [ 6] .strtab STRTAB 0000000000000000 00000290 0000000000000001 0000000000000000 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) >
I don't think that we are going to change this. It may be a bit inefficient and require some conditional compilation but it seems to work reasonably well for all our dev, nightly and buildbot machines.