clangupc / clang-upc

Clang UPC Front-End
https://clangupc.github.io/
Other
16 stars 5 forks source link

RFE: auto-disable the linker script where appropriate #60

Closed PHHargrove closed 10 years ago

PHHargrove commented 10 years ago

Unless I am missing something we still expect whoever is building clang-upc to manually disable the UPC liker script on Darwin. The Solaris support that is nearing completion also requires one the manually disable the linker script.

Is there any reason not to make the following change (and the autoconf equivalent)?

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -202,6 +202,10 @@ endif()

 # UPC link script
 set(LIBUPC_ENABLE_LINK_SCRIPT TRUE CACHE STRING "enable UPC's use of a custom linker script; this will define the UPC shared section as a no load section on targets where this feature is supported (requires GNU LD)")
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR
+    ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
+  set( LIBUPC_ENABLE_LINK_SCRIPT FALSE )
+}
 set(LIBUPC_LINK_SCRIPT ${LIBUPC_ENABLE_LINK_SCRIPT})

 # Check for backtrace on systems (freebsd,..) that need an extra library
nenadv commented 10 years ago

This makes sense. Note however, that Darwin Driver/Tools.cpp Link::ConstructJob does not try to place "-T" option on the linker line and we are silently ignore the linker script option. I suspect the same is true for solaris. So configuring it would not make a difference on that level (this cmake creates include/clang/Config/config.h that we use for compiling Clang sources).

But, we also need the same change in runtime/libupc/CMakeLists.txt, in which case it is necessary. Making the code in both files the same is appropriate. At some pint I have to compact this and use only one cmake file for all the duplicates.

Not to be picky, I don't like silent overrides if the user explicitly used the switch. We have few of those and I never researched the issue.

On 6/25/14 5:18 PM, Paul H. Hargrove wrote:

Unless I am missing something we still expect whoever is building clang-upc to manually disable the UPC liker script on Darwin. The Solaris support that is nearing completion also requires one the manually disable the linker script.

Is there any reason not to make the following change (and the autoconf equivalent)?

--- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,6 +202,10 @@ endif()

UPC link script

set(LIBUPC_ENABLE_LINK_SCRIPT TRUE CACHE STRING "enable UPC's use of a custom linker script; this will define the UPC shared section as a no load section on targets where this feature is supported (requires GNU LD)") +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR

  • ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
  • set( LIBUPC_ENABLE_LINK_SCRIPT FALSE ) +} set(LIBUPC_LINK_SCRIPT ${LIBUPC_ENABLE_LINK_SCRIPT})

    Check for backtrace on systems (freebsd,..) that need an extra library

— Reply to this email directly or view it on GitHub https://github.com/Intrepid/clang-upc/issues/60.

PHHargrove commented 10 years ago

Note that on Solaris the command to build the linker script fails because ld is not the gnu linker:

$ echo "int main(){}" | gcc -Xlinker --verbose -o /dev/null -xc -
ld: fatal: unrecognized option '--'

That creates a need to disable the link script on Solaris independent of passing (or not) the '-T' option at application link time.

We have few of those [...]

At first I read that as referring to "users" rather than to "silent overrides" or "switches". :-)

nenadv commented 10 years ago

Fixed by https://github.com/Intrepid/clang-upc/commit/038160c659ddf6cbc796f98f49af7fb100c3a0f6 and https://github.com/Intrepid/llvm-upc/commit/6576fcd2dc8f8d43928638270679721d4bf4dd10