* [Qemu-devel] Problems encountered while building qemu-0.6.1 @ 2005-02-20 14:59 Peter S. Mazinger 2005-02-20 15:45 ` [Qemu-devel] " Peter S. Mazinger 0 siblings, 1 reply; 5+ messages in thread From: Peter S. Mazinger @ 2005-02-20 14:59 UTC (permalink / raw) To: qemu-devel Hello! 1. CFLAGS/LDFLAGS from config-host.mak are overwritten/ignored 2. VL_LDFLAGS/OP_CFLAGS should also "inherit" from config-host.mak 3. Trying to build qemu in an environment, where gcc defaults to -fPIC fails building op.o/osdep.o/helper.o. If I disable -fPIC on the complete build, the resulting qemu-* files contain text relocations (readelf -d <file>). Due to the fact that they are like shared libs, the text relocs should not be present. 4. The files qemu-* (user and sofmmu) are created w/ LDFLAGS=-Wl,-shared creting ET_DYN/PIE executables. gcc-3.4 and binutils-2.15 support gcc -pie/ld -pie, this can be checked by gcc -fpie and ld --help | grep pie 5. building qemu w/ a propolice/ssp patched gcc, op.o creation fails if -fstack-protector-all is enabled. Please CC to me, I am not subscribed, thanks. Peter -- Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2 Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: Problems encountered while building qemu-0.6.1 2005-02-20 14:59 [Qemu-devel] Problems encountered while building qemu-0.6.1 Peter S. Mazinger @ 2005-02-20 15:45 ` Peter S. Mazinger 2005-02-22 11:21 ` Peter S. Mazinger 0 siblings, 1 reply; 5+ messages in thread From: Peter S. Mazinger @ 2005-02-20 15:45 UTC (permalink / raw) To: qemu-devel On Sun, 20 Feb 2005, Peter S. Mazinger wrote: for current cvs almost everything applies, some changes though. > Hello! > > 1. CFLAGS/LDFLAGS from config-host.mak are overwritten/ignored > 2. VL_LDFLAGS/OP_CFLAGS should also "inherit" from config-host.mak > 3. Trying to build qemu in an environment, where gcc defaults to -fPIC > fails building op.o/osdep.o/helper.o. only op.o/helper.o fail. > If I disable -fPIC on the complete build, the resulting qemu-* files > contain text relocations (readelf -d <file>). Due to the fact that they > are like shared libs, the text relocs should not be present. > 4. The files qemu-* (user and sofmmu) are created w/ LDFLAGS=-Wl,-shared > creting ET_DYN/PIE executables. gcc-3.4 and binutils-2.15 support gcc > -pie/ld -pie, this can be checked by gcc -fpie and ld --help | grep pie > 5. building qemu w/ a propolice/ssp patched gcc, op.o creation fails if > -fstack-protector-all is enabled. if op.o is built w/ -fstack-protector, it fails creating op.h > > Please CC to me, I am not subscribed, thanks. > > Peter > > -- Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2 Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: Problems encountered while building qemu-0.6.1 2005-02-20 15:45 ` [Qemu-devel] " Peter S. Mazinger @ 2005-02-22 11:21 ` Peter S. Mazinger 2005-02-22 12:04 ` Peter S. Mazinger 0 siblings, 1 reply; 5+ messages in thread From: Peter S. Mazinger @ 2005-02-22 11:21 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: TEXT/PLAIN, Size: 1826 bytes --] On Sun, 20 Feb 2005, Peter S. Mazinger wrote: I have attached 2 patches showing what is needed (and commented the errors) building w/ gcc-3.3.5 and gcc-3.4.3 (the only diff is building op_helper.o fails w/ gcc-3.3.5) I can help w/ the ssp (stack-protector) tests, if noone has such gcc, the -fno-pic failure can be easily "simulated" replacing -fno-pic with -fPIC. The tests were done w/ latest cvs (20050221) The attached patches allow building qemu, but do not remove the text relocations (probably produced by using -fno-pic) Peter > On Sun, 20 Feb 2005, Peter S. Mazinger wrote: > > for current cvs almost everything applies, some changes though. > > > Hello! > > > > 1. CFLAGS/LDFLAGS from config-host.mak are overwritten/ignored > > 2. VL_LDFLAGS/OP_CFLAGS should also "inherit" from config-host.mak > > 3. Trying to build qemu in an environment, where gcc defaults to -fPIC > > fails building op.o/osdep.o/helper.o. > > only op.o/helper.o fail. > > > If I disable -fPIC on the complete build, the resulting qemu-* files > > contain text relocations (readelf -d <file>). Due to the fact that they > > are like shared libs, the text relocs should not be present. > > 4. The files qemu-* (user and sofmmu) are created w/ LDFLAGS=-Wl,-shared > > creting ET_DYN/PIE executables. gcc-3.4 and binutils-2.15 support gcc > > -pie/ld -pie, this can be checked by gcc -fpie and ld --help | grep pie > > 5. building qemu w/ a propolice/ssp patched gcc, op.o creation fails if > > -fstack-protector-all is enabled. > > if op.o is built w/ -fstack-protector, it fails creating op.h > > > > > Please CC to me, I am not subscribed, thanks. > > > > Peter > > > > > > -- Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2 Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2 [-- Attachment #2: Type: TEXT/PLAIN, Size: 712 bytes --] --- qemu/Makefile.target.mps 2005-02-22 11:06:38 +0100 +++ qemu/Makefile.target 2005-02-22 12:13:23 +0100 @@ -400,10 +400,18 @@ $(DYNGEN) -g -o $@ $< op.o: op.c - $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< +ifeq ($(TARGET_BASE_ARCH), i386) + $(CC) $(OP_CFLAGS) $(DEFINES) -fno-pic -fno-stack-protector -c -o $@ $< +else + $(CC) $(OP_CFLAGS) $(DEFINES) -fno-pic -fno-stack-protector-all -c -o $@ $< +endif helper.o: helper.c +ifdef CONFIG_SOFTMMU + $(CC) $(HELPER_CFLAGS) $(DEFINES) -fno-pic -c -o $@ $< +else $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< +endif ifeq ($(TARGET_BASE_ARCH), i386) op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h [-- Attachment #3: Type: TEXT/PLAIN, Size: 1325 bytes --] --- qemu/Makefile.target.mps 2005-02-22 11:06:38 +0100 +++ qemu/Makefile.target 2005-02-22 11:52:45 +0100 @@ -399,11 +399,24 @@ gen-op.h: op.o $(DYNGEN) $(DYNGEN) -g -o $@ $< +# -fno-pic is needed, else dyngen -o op.h op.o says 'dyngen: unsupported i386 relocation (10)' +# -fno-stack-protector is needed, else compiling translate-all.c says +# 'op.h: ...: error: parse error before ')' token at many locations +# -fno-stack-protector-all produces less of them on i386/x86_64 op.o: op.c - $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< +ifeq ($(TARGET_BASE_ARCH), i386) + $(CC) $(OP_CFLAGS) $(DEFINES) -fno-pic -fno-stack-protector -c -o $@ $< +else + $(CC) $(OP_CFLAGS) $(DEFINES) -fno-pic -fno-stack-protector-all -c -o $@ $< +endif +# -fno-pic is needed, else out of registers helper.o: helper.c +ifdef CONFIG_SOFTMMU + $(CC) $(HELPER_CFLAGS) $(DEFINES) -fno-pic -c -o $@ $< +else $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< +endif ifeq ($(TARGET_BASE_ARCH), i386) op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h @@ -415,6 +428,9 @@ ifeq ($(TARGET_BASE_ARCH), sparc) op.o: op.c op_template.h op_mem.h +# out of registers +op_helper.o: op_helper.c + $(CC) $(CFLAGS) $(DEFINES) -fno-pic -c -o $@ $< endif ifeq ($(TARGET_ARCH), ppc) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: Problems encountered while building qemu-0.6.1 2005-02-22 11:21 ` Peter S. Mazinger @ 2005-02-22 12:04 ` Peter S. Mazinger 2005-02-22 15:33 ` Peter S. Mazinger 0 siblings, 1 reply; 5+ messages in thread From: Peter S. Mazinger @ 2005-02-22 12:04 UTC (permalink / raw) To: qemu-devel On Tue, 22 Feb 2005, Peter S. Mazinger wrote: > On Sun, 20 Feb 2005, Peter S. Mazinger wrote: > > I have attached 2 patches showing what is needed (and commented the > errors) building w/ gcc-3.3.5 and gcc-3.4.3 (the only diff is building > op_helper.o fails w/ gcc-3.3.5) > > I can help w/ the ssp (stack-protector) tests, if noone has such gcc, the > -fno-pic failure can be easily "simulated" replacing -fno-pic with -fPIC. > > The tests were done w/ latest cvs (20050221) > The attached patches allow building qemu, but do not remove the text > relocations (probably produced by using -fno-pic) the relocation types not recognized by dyngen are R_386_GOT32/R_386_GOTOFF/R_386_GOTPC/R_386_PLT32 Peter > > > On Sun, 20 Feb 2005, Peter S. Mazinger wrote: > > > > for current cvs almost everything applies, some changes though. > > > > > Hello! > > > > > > 1. CFLAGS/LDFLAGS from config-host.mak are overwritten/ignored > > > 2. VL_LDFLAGS/OP_CFLAGS should also "inherit" from config-host.mak > > > 3. Trying to build qemu in an environment, where gcc defaults to -fPIC > > > fails building op.o/osdep.o/helper.o. > > > > only op.o/helper.o fail. > > > > > If I disable -fPIC on the complete build, the resulting qemu-* files > > > contain text relocations (readelf -d <file>). Due to the fact that they > > > are like shared libs, the text relocs should not be present. > > > 4. The files qemu-* (user and sofmmu) are created w/ LDFLAGS=-Wl,-shared > > > creting ET_DYN/PIE executables. gcc-3.4 and binutils-2.15 support gcc > > > -pie/ld -pie, this can be checked by gcc -fpie and ld --help | grep pie > > > 5. building qemu w/ a propolice/ssp patched gcc, op.o creation fails if > > > -fstack-protector-all is enabled. > > > > if op.o is built w/ -fstack-protector, it fails creating op.h > > > > > > > > Please CC to me, I am not subscribed, thanks. > > > > > > Peter > > > > > > > > > > > > -- Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2 Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: Problems encountered while building qemu-0.6.1 2005-02-22 12:04 ` Peter S. Mazinger @ 2005-02-22 15:33 ` Peter S. Mazinger 0 siblings, 0 replies; 5+ messages in thread From: Peter S. Mazinger @ 2005-02-22 15:33 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: TEXT/PLAIN, Size: 3098 bytes --] On Tue, 22 Feb 2005, Peter S. Mazinger wrote: > On Tue, 22 Feb 2005, Peter S. Mazinger wrote: > > > On Sun, 20 Feb 2005, Peter S. Mazinger wrote: > > > > I have attached 2 patches showing what is needed (and commented the > > errors) building w/ gcc-3.3.5 and gcc-3.4.3 (the only diff is building > > op_helper.o fails w/ gcc-3.3.5) > > > > I can help w/ the ssp (stack-protector) tests, if noone has such gcc, the > > -fno-pic failure can be easily "simulated" replacing -fno-pic with -fPIC. > > > > The tests were done w/ latest cvs (20050221) > > The attached patches allow building qemu, but do not remove the text > > relocations (probably produced by using -fno-pic) > > the relocation types not recognized by dyngen are > R_386_GOT32/R_386_GOTOFF/R_386_GOTPC/R_386_PLT32 after adding these to dyngen.c (I think also the equivalent x86_64 types should be added too) all the arch-user/qemu-* files are w/o text relocations Remaining issue w/ PIC code are op.o and helper.o for all softmmu targets (ifdef CONFIG_SOFTMMU) if these files are built for i386-softmmu/op.c: target-i386/ops_mem.h: In function `op_ldub_kernel_T0_A0': softmmu_header.h:96: error: can't find a register in class `GENERAL_REGS' while reloading `asm' for i386-softmmu/helper.o: softmmu_template.h: In function slow_ldq_mmu 159: error: unable to find a register to spill in class `GENERAL_REGS' ... insn ... if I add -fno-pic to op.o (i386-softmmu) and helper.o (all softmmu targets) the above errors are gone, but all the qemu-system-* files have text relocations. Attached my latest working release, the rest of the problems related to ssp/propolice remain. Peter > > > > > On Sun, 20 Feb 2005, Peter S. Mazinger wrote: > > > > > > for current cvs almost everything applies, some changes though. > > > > > > > Hello! > > > > > > > > 1. CFLAGS/LDFLAGS from config-host.mak are overwritten/ignored > > > > 2. VL_LDFLAGS/OP_CFLAGS should also "inherit" from config-host.mak > > > > 3. Trying to build qemu in an environment, where gcc defaults to -fPIC > > > > fails building op.o/osdep.o/helper.o. > > > > > > only op.o/helper.o fail. > > > > > > > If I disable -fPIC on the complete build, the resulting qemu-* files > > > > contain text relocations (readelf -d <file>). Due to the fact that they > > > > are like shared libs, the text relocs should not be present. > > > > 4. The files qemu-* (user and sofmmu) are created w/ LDFLAGS=-Wl,-shared > > > > creting ET_DYN/PIE executables. gcc-3.4 and binutils-2.15 support gcc > > > > -pie/ld -pie, this can be checked by gcc -fpie and ld --help | grep pie > > > > 5. building qemu w/ a propolice/ssp patched gcc, op.o creation fails if > > > > -fstack-protector-all is enabled. > > > > > > if op.o is built w/ -fstack-protector, it fails creating op.h > > > > > > > > > > > Please CC to me, I am not subscribed, thanks. > > > > > > > > Peter > > > > > > > > > > > > > > > > > > > > -- Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2 Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2 [-- Attachment #2: Type: TEXT/PLAIN, Size: 1427 bytes --] --- qemu/dyngen.c.mps 2005-02-22 13:41:53 +0100 +++ qemu/dyngen.c 2005-02-22 15:57:53 +0100 @@ -1661,6 +1661,10 @@ type = ELF32_R_TYPE(rel->r_info); switch(type) { case R_386_32: + case R_386_GOTPC: + case R_386_GOT32: + case R_386_PLT32: + case R_386_GOTOFF: fprintf(outfile, " *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", rel->r_offset - start_offset, name, addend); break; --- qemu/Makefile.target.mps 2005-02-22 11:06:38 +0100 +++ qemu/Makefile.target 2005-02-22 16:25:13 +0100 @@ -399,11 +399,24 @@ gen-op.h: op.o $(DYNGEN) $(DYNGEN) -g -o $@ $< +# -fno-pic: out of registers op.o: op.c - $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< +ifeq ($(TARGET_BASE_ARCH), i386) +ifdef CONFIG_SOFTMMU + $(CC) $(OP_CFLAGS) $(DEFINES) -fno-stack-protector -fno-pic -c -o $@ $< +else + $(CC) $(OP_CFLAGS) $(DEFINES) -fno-stack-protector -c -o $@ $< +endif +else + $(CC) $(OP_CFLAGS) $(DEFINES) -fno-stack-protector-all -c -o $@ $< +endif helper.o: helper.c +ifdef CONFIG_SOFTMMU + $(CC) $(HELPER_CFLAGS) $(DEFINES) -fno-pic -c -o $@ $< +else $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< +endif ifeq ($(TARGET_BASE_ARCH), i386) op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-02-22 15:50 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-02-20 14:59 [Qemu-devel] Problems encountered while building qemu-0.6.1 Peter S. Mazinger 2005-02-20 15:45 ` [Qemu-devel] " Peter S. Mazinger 2005-02-22 11:21 ` Peter S. Mazinger 2005-02-22 12:04 ` Peter S. Mazinger 2005-02-22 15:33 ` Peter S. Mazinger
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).