diff mbox series

[alpha] Move linux-specific specfile definitions to linux.h

Message ID 20170903154719.GA18593@SDF.ORG
State New
Headers show
Series [alpha] Move linux-specific specfile definitions to linux.h | expand

Commit Message

Maya Rashish Sept. 3, 2017, 3:47 p.m. UTC
Hi, in my first attempt to fix a build issue I found that the order of
tm files matters, would prefer to move linux-looking parts of elf.h to
linux.h.

other targets that include alpha/elf.h besides linux:
openbsd:  provides their own STARTFILE_SPEC and ENDFILE_SPEC in later file:
https://github.com/openbsd/ports/blob/master/lang/gcc/6/patches/patch-gcc_config_alpha_openbsd_h
freebsd:  dropped alpha in freebsd 7.0 (2008)

Built trunk on netbsd/alpha (until I out of spaced with a working stage3
after two days :-)) with some extra modifications.

---
 gcc/config/alpha/elf.h   | 26 --------------------------
 gcc/config/alpha/linux.h | 26 ++++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 26 deletions(-)

Comments

Jeff Law Oct. 13, 2017, 5:13 p.m. UTC | #1
On 09/03/2017 09:47 AM, Maya Rashish wrote:
> Hi, in my first attempt to fix a build issue I found that the order of
> tm files matters, would prefer to move linux-looking parts of elf.h to
> linux.h.
> 
> other targets that include alpha/elf.h besides linux:
> openbsd:  provides their own STARTFILE_SPEC and ENDFILE_SPEC in later file:
> https://github.com/openbsd/ports/blob/master/lang/gcc/6/patches/patch-gcc_config_alpha_openbsd_h
> freebsd:  dropped alpha in freebsd 7.0 (2008)
> 
> Built trunk on netbsd/alpha (until I out of spaced with a working stage3
> after two days :-)) with some extra modifications.
So we can't depend on patches that OpenBSD applies.  What's important is
what is in the official GCC sources.

I'd like to see some discussion about what these macros should look like
for the *bsd ports.  Merely removing them from elf.h without providing
something for the *bsd ports seems wrong to me.


Jeff
Maya Rashish Oct. 25, 2017, 1:26 a.m. UTC | #2
On Fri, Oct 13, 2017 at 11:13:52AM -0600, Jeff Law wrote:
> So we can't depend on patches that OpenBSD applies.  What's important is
> what is in the official GCC sources.
> 
> I'd like to see some discussion about what these macros should look like
> for the *bsd ports.  Merely removing them from elf.h without providing
> something for the *bsd ports seems wrong to me.

Hi Jeff,

OpenBSD has no crt1.o, crtn.o, and crtfastmath.o Linking to those
would fail.  As testimony: they are overriding it locally.

And journalists may say, "OpenBSD has declined to comment on this patch".
Jeff Law Nov. 19, 2017, 11:09 p.m. UTC | #3
On 10/24/2017 07:26 PM, coypu@sdf.org wrote:
> On Fri, Oct 13, 2017 at 11:13:52AM -0600, Jeff Law wrote:
>> So we can't depend on patches that OpenBSD applies.  What's important is
>> what is in the official GCC sources.
>>
>> I'd like to see some discussion about what these macros should look like
>> for the *bsd ports.  Merely removing them from elf.h without providing
>> something for the *bsd ports seems wrong to me.
> 
> Hi Jeff,
> 
> OpenBSD has no crt1.o, crtn.o, and crtfastmath.o Linking to those
> would fail.  As testimony: they are overriding it locally.
> 
> And journalists may say, "OpenBSD has declined to comment on this patch".
But it does have other crt files such as crt0.o, crtend.o, crtbegin.o
that are supposed to be handled by the SPEC files.

Pulling these out of elf.h *may* still be sensible, but it really
doesn't seem to address the problem of what the proper definition should
be for OpenBSD.

jeff
diff mbox series

Patch

diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
index c109b07c5..8a435dbc0 100644
--- a/gcc/config/alpha/elf.h
+++ b/gcc/config/alpha/elf.h
@@ -100,32 +100,6 @@  do {									\
     ASM_OUTPUT_DEF (FILE, alias, name);				\
   } while (0)
 
-/* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
-   (even more) magical crtbegin.o file which provides part of the
-   support for getting C++ file-scope static object constructed
-   before entering `main'.  */
-
-#undef	STARTFILE_SPEC
-#ifdef HAVE_LD_PIE
-#define STARTFILE_SPEC \
-  "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#else
-#define STARTFILE_SPEC \
-  "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#endif
-
-/* Provide a ENDFILE_SPEC appropriate for ELF.  Here we tack on the
-   magical crtend.o file which provides part of the support for
-   getting C++ file-scope static object constructed before entering
-   `main', followed by a normal ELF "finalizer" file, `crtn.o'.  */
-
-#undef	ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
-   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
-
 /* This variable should be set to 'true' if the target ABI requires
    unwinding tables even when exceptions are not used.  */
 #define TARGET_UNWIND_TABLES_DEFAULT true
diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
index e15013eb9..cd0099779 100644
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -78,6 +78,32 @@  along with GCC; see the file COPYING3.  If not see
 
 #define TARGET_POSIX_IO
 
+/* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
+   (even more) magical crtbegin.o file which provides part of the
+   support for getting C++ file-scope static object constructed
+   before entering `main'.  */
+
+#undef	STARTFILE_SPEC
+#ifdef HAVE_LD_PIE
+#define STARTFILE_SPEC \
+  "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+#else
+#define STARTFILE_SPEC \
+  "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
+   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+#endif
+
+/* Provide a ENDFILE_SPEC appropriate for ELF.  Here we tack on the
+   magical crtend.o file which provides part of the support for
+   getting C++ file-scope static object constructed before entering
+   `main', followed by a normal ELF "finalizer" file, `crtn.o'.  */
+
+#undef	ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
 #define LINK_GCC_C_SEQUENCE_SPEC \
   "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"