diff mbox

[take2] Make LTO plugin object-file-format- and host- independent.

Message ID 4CB69B25.8050106@gmail.com
State New
Headers show

Commit Message

Dave Korn Oct. 14, 2010, 5:54 a.m. UTC
On 12/10/2010 14:36, Richard Sandiford wrote:
> Hi Dave,
> 
> Sorry if this is a dup, but...
> 
> Dave Korn <dave.korn.cygwin@gmail.com> writes:
>> 	* configure.ac: Source config.gcc to determine lto_binary_reader.
> 
> ...I've been experimenting with some ARM builds and noticed that this
> doesn't quite work with options like --with-cpu.  The problem is that
> config.gcc validates the option against ${srcdir}/config/arm/arm-cores.def
> and exits the configure script if it can't find the file.
> 
> It's a little (read "very") hackish, but how about the following?
> Tested on arm-linux-gnueabi using --with-cpu=cortex-a8.  Alternatively,
> we could add a new m4 macro for setting lto_binary_reader.

  I reckon there are so few targets to which any of this applies that it's not
worth busting a gut over.  I'm planning on just doing this in the patch that
makes the coff lto-plugin work:



  Once I realised I was going to need a couple of other pieces of information
that I couldn't get from groping about in config.gcc anyway, the whole pain
seemed just more trouble than it was worth.  Makes sense to you?

    cheers,
      DaveK

Comments

Richard Henderson Oct. 14, 2010, 4:29 p.m. UTC | #1
On 10/13/2010 10:54 PM, Dave Korn wrote:
> +  x86_64*-mingw*)
> +    SYM_STYLE=elf

What does SYM_STYLE mean?  No leading underscore?


r~
Kai Tietz Oct. 14, 2010, 4:57 p.m. UTC | #2
2010/10/14 Richard Henderson <rth@redhat.com>:
> On 10/13/2010 10:54 PM, Dave Korn wrote:
>> +  x86_64*-mingw*)
>> +    SYM_STYLE=elf
>
> What does SYM_STYLE mean?  No leading underscore?
>
>
> r~
>

Yes, it is intended for specifying leading underscore. I was
discussing this with Dave offlist already. The value of this SYM_STYLE
is more then questionable as it is misleading. It is true that x64
mingw don't use underscores by default, but for sure it has less with
ELF in common (btw there is arm wince, which has no leading
underscores, too). So to define that win32 means leading underscore is
here also not correct.
I would suggest to name the thing by its real name and use
"SYM_STYLE=underscore" and "SYM_STYLE=none". Maybe the word SYM_STLYE
could be renamed into SYM_UNDERSCORED and the values are simply "yes"
and "no".

Regards,
Kai
Richard Henderson Oct. 14, 2010, 5:11 p.m. UTC | #3
On 10/14/2010 09:57 AM, Kai Tietz wrote:
> I would suggest to name the thing by its real name and use
> "SYM_STYLE=underscore" and "SYM_STYLE=none". Maybe the word SYM_STLYE
> could be renamed into SYM_UNDERSCORED and the values are simply "yes"
> and "no".

I don't mind =underscore.

It leaves the door open for something more odd.
Like the sym + .sym style used by ppc64.


r~
diff mbox

Patch

Index: lto-plugin/configure.ac
===================================================================
--- lto-plugin/configure.ac	(revision 165450)
+++ lto-plugin/configure.ac	(working copy)
@@ -10,14 +10,27 @@  AC_ARG_VAR(LIBELFLIBS,[How to link libelf])
 AC_ARG_VAR(LIBELFINC,[How to find libelf include files])
 AM_PROG_LIBTOOL
 AC_SUBST(target_noncanonical)
-. ${srcdir}/../gcc/config.gcc
-case ${lto_binary_reader} in
-  *coff*) LTO_FORMAT=coff ;;
-  *elf*)  LTO_FORMAT=elf ;;
-  *) AC_MSG_ERROR([LTO plugin is not supported on this target.]) ;;
+# Trying to get this information from gcc's config is tricky.
+case $target in
+  x86_64*-mingw*)
+    SYM_STYLE=elf
+    LTO_FORMAT=coff
+    COFFENDIAN=-DCOFFENDIAN=0
+    ;;
+  *-cygwin* | *-mingw* )
+    SYM_STYLE=win32
+    LTO_FORMAT=coff
+    COFFENDIAN=-DCOFFENDIAN=0
+    ;;
+  *)
+    SYM_STYLE=elf
+    LTO_FORMAT=elf
+    COFFENDIAN=
+    ;;
 esac
-
+AC_SUBST(SYM_STYLE)
 AC_SUBST(LTO_FORMAT)
+AC_SUBST(COFFENDIAN)
 AC_TYPE_UINT64_T
 AC_CONFIG_FILES(Makefile)
 AC_OUTPUT