Commit fa282484b373f4c5751cb46fb2daa8ba0245fe5c

Authored by Juan Quintela
Committed by Anthony Liguori
1 parent 4318e1a6

generate LDFLAGS for *-linux-user and *-bsd-user in a single place in configure

Remove lots of duplicate code in the process

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 2 changed files with 39 additions and 132 deletions
Makefile.target
@@ -169,72 +169,6 @@ ifdef CONFIG_LINUX_USER @@ -169,72 +169,6 @@ ifdef CONFIG_LINUX_USER
169 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) 169 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
170 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) 170 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
171 171
172 -ifeq ($(ARCH),i386)  
173 -ifdef TARGET_GPROF  
174 -USE_I386_LD=y  
175 -endif  
176 -ifdef CONFIG_STATIC  
177 -USE_I386_LD=y  
178 -endif  
179 -ifdef USE_I386_LD  
180 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
181 -else  
182 -# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object  
183 -# that the kernel ELF loader considers as an executable. I think this  
184 -# is the simplest way to make it self virtualizable!  
185 -LDFLAGS+=-Wl,-shared  
186 -endif  
187 -endif  
188 -  
189 -ifeq ($(ARCH),x86_64)  
190 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
191 -endif  
192 -  
193 -ifeq ($(ARCH),ppc)  
194 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
195 -endif  
196 -  
197 -ifeq ($(ARCH),ppc64)  
198 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
199 -endif  
200 -  
201 -ifeq ($(ARCH),s390)  
202 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
203 -endif  
204 -  
205 -ifeq ($(ARCH),sparc)  
206 -# -static is used to avoid g1/g3 usage by the dynamic linker  
207 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static  
208 -endif  
209 -  
210 -ifeq ($(ARCH),sparc64)  
211 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
212 -endif  
213 -  
214 -ifeq ($(ARCH),alpha)  
215 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
216 -endif  
217 -  
218 -ifeq ($(ARCH),ia64)  
219 -LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld  
220 -endif  
221 -  
222 -ifeq ($(ARCH),arm)  
223 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
224 -endif  
225 -  
226 -ifeq ($(ARCH),m68k)  
227 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
228 -endif  
229 -  
230 -ifeq ($(ARCH),mips)  
231 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
232 -endif  
233 -  
234 -ifeq ($(ARCH),mips64)  
235 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
236 -endif  
237 -  
238 # profiling code 172 # profiling code
239 ifdef TARGET_GPROF 173 ifdef TARGET_GPROF
240 LDFLAGS+=-p 174 LDFLAGS+=-p
@@ -304,72 +238,6 @@ ifdef CONFIG_BSD_USER @@ -304,72 +238,6 @@ ifdef CONFIG_BSD_USER
304 VPATH+=:$(SRC_PATH)/bsd-user 238 VPATH+=:$(SRC_PATH)/bsd-user
305 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) 239 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
306 240
307 -ifeq ($(ARCH),i386)  
308 -ifdef TARGET_GPROF  
309 -USE_I386_LD=y  
310 -endif  
311 -ifdef CONFIG_STATIC  
312 -USE_I386_LD=y  
313 -endif  
314 -ifdef USE_I386_LD  
315 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
316 -else  
317 -# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object  
318 -# that the kernel ELF loader considers as an executable. I think this  
319 -# is the simplest way to make it self virtualizable!  
320 -LDFLAGS+=-Wl,-shared  
321 -endif  
322 -endif  
323 -  
324 -ifeq ($(ARCH),x86_64)  
325 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
326 -endif  
327 -  
328 -ifeq ($(ARCH),ppc)  
329 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
330 -endif  
331 -  
332 -ifeq ($(ARCH),ppc64)  
333 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
334 -endif  
335 -  
336 -ifeq ($(ARCH),s390)  
337 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
338 -endif  
339 -  
340 -ifeq ($(ARCH),sparc)  
341 -# -static is used to avoid g1/g3 usage by the dynamic linker  
342 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static  
343 -endif  
344 -  
345 -ifeq ($(ARCH),sparc64)  
346 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
347 -endif  
348 -  
349 -ifeq ($(ARCH),alpha)  
350 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
351 -endif  
352 -  
353 -ifeq ($(ARCH),ia64)  
354 -LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld  
355 -endif  
356 -  
357 -ifeq ($(ARCH),arm)  
358 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
359 -endif  
360 -  
361 -ifeq ($(ARCH),m68k)  
362 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
363 -endif  
364 -  
365 -ifeq ($(ARCH),mips)  
366 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
367 -endif  
368 -  
369 -ifeq ($(ARCH),mips64)  
370 -LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld  
371 -endif  
372 -  
373 obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \ 241 obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
374 gdbstub.o gdbstub-xml.o ioport-user.o 242 gdbstub.o gdbstub-xml.o ioport-user.o
375 obj-y += uaccess.o 243 obj-y += uaccess.o
configure
@@ -2042,6 +2042,45 @@ if test &quot;$target_bsd_user&quot; = &quot;yes&quot; ; then @@ -2042,6 +2042,45 @@ if test &quot;$target_bsd_user&quot; = &quot;yes&quot; ; then
2042 echo "CONFIG_BSD_USER=y" >> $config_mak 2042 echo "CONFIG_BSD_USER=y" >> $config_mak
2043 fi 2043 fi
2044 2044
  2045 +# generate LDFLAGS for targets
  2046 +
  2047 +ldflags=""
  2048 +if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
  2049 + case "$ARCH" in
  2050 + i386)
  2051 + if test "$gprof" = "yes" -o "$static" = "yes" ; then
  2052 + ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld'
  2053 + else
  2054 + # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
  2055 + # that the kernel ELF loader considers as an executable. I think this
  2056 + # is the simplest way to make it self virtualizable!
  2057 + ldflags='-Wl,-shared'
  2058 + fi
  2059 + ;;
  2060 + sparc)
  2061 + # -static is used to avoid g1/g3 usage by the dynamic linker
  2062 + ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
  2063 + ;;
  2064 + ia64)
  2065 + ldflags='-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
  2066 + ;;
  2067 + x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
  2068 + ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld'
  2069 + ;;
  2070 + esac
  2071 +fi
  2072 +if test "$target_softmmu" = "yes" ; then
  2073 + case "$ARCH" in
  2074 + ia64)
  2075 + ldflags='-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
  2076 + ;;
  2077 + esac
  2078 +fi
  2079 +
  2080 +if test "$ldflags" != "" ; then
  2081 + echo "LDFLAGS+=$ldflags" >> $config_mak
  2082 +fi
  2083 +
2045 echo "/* Automatically generated by configure - do not modify */" > $config_h 2084 echo "/* Automatically generated by configure - do not modify */" > $config_h
2046 echo "#include \"../config-host.h\"" >> $config_h 2085 echo "#include \"../config-host.h\"" >> $config_h
2047 2086