Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link Time Optimization experiment #3071

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
libgl1-mesa-dev libglu1-mesa-dev libxinerama-dev \
libxcursor-dev libxfixes-dev libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev ninja-build libxft-dev \
llvm mold libpipewire-0.3-dev libdbus-1-dev
llvm mold libpipewire-0.3-dev libdbus-1-dev libvlc-dev
sudo locale-gen en_US.UTF-8
sudo locale-gen en_GB.UTF-8
sudo locale-gen fr_FR.UTF-8
Expand Down
118 changes: 0 additions & 118 deletions autobuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -409,36 +409,6 @@
<key>description</key>
<string>Library for transferring data specified with URL syntax</string>
</map>
<key>dbus_glib</key>
<map>
<key>platforms</key>
<map>
<key>linux64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>7ee7b9aed3c0c8c09e7bf26bba7af8e1</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-dbus-glib/rev/314266/arch/Linux/installer/dbus_glib-0.76-linux64-314266.tar.bz2</string>
</map>
<key>name</key>
<string>linux64</string>
</map>
</map>
<key>license</key>
<string>Academic Free License v. 2.1</string>
<key>license_file</key>
<string>LICENSES/dbus-glib.txt</string>
<key>copyright</key>
<string>Copyright (C) Red Hat Inc.</string>
<key>version</key>
<string>0.76</string>
<key>name</key>
<string>dbus_glib</string>
<key>description</key>
<string>D-Bus bindings for glib</string>
</map>
<key>dictionaries</key>
<map>
<key>platforms</key>
Expand Down Expand Up @@ -625,36 +595,6 @@
<key>description</key>
<string>Expat is an XML parser library written in C</string>
</map>
<key>fontconfig</key>
<map>
<key>platforms</key>
<map>
<key>linux64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>e2419d56960c160670051fbb055fb729</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-fontconfig/rev/314281/arch/Linux/installer/fontconfig-2.11.0-linux64-314281.tar.bz2</string>
</map>
<key>name</key>
<string>linux64</string>
</map>
</map>
<key>license</key>
<string>bsd</string>
<key>license_file</key>
<string>LICENSES/fontconfig.txt</string>
<key>copyright</key>
<string>Copyright (C) 2000,2001,2002,2003,2004,2006,2007 Keith Packard, 2005 Patrick Lam, 2009 Roozbeh Pournader, 2008,2009 Red Hat, Inc., 2008 Danilo Šegan, 2012 Google, Inc.</string>
<key>version</key>
<string>2.11.0</string>
<key>name</key>
<string>fontconfig</string>
<key>description</key>
<string>Fontconfig is a library for configuring and customizing font access.</string>
</map>
<key>freetype</key>
<map>
<key>copyright</key>
Expand Down Expand Up @@ -821,34 +761,6 @@
<key>source_type</key>
<string>git</string>
</map>
<key>gstreamer</key>
<map>
<key>platforms</key>
<map>
<key>linux64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>7c9d7cc88add7831a6afeedc20cad2fe</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-gstreamer/rev/314267/arch/Linux/installer/gstreamer-0.10.6.314267-linux64-314267.tar.bz2</string>
</map>
<key>name</key>
<string>linux64</string>
</map>
</map>
<key>license</key>
<string>LGPL</string>
<key>license_file</key>
<string>LICENSES/gstreamer.txt</string>
<key>copyright</key>
<string>Copyright (C) 2007 Free Software Foundation, Inc. &lt;http://fsf.org/&gt;</string>
<key>version</key>
<string>0.10.6.314267</string>
<key>name</key>
<string>gstreamer</string>
</map>
<key>havok-source</key>
<map>
<key>platforms</key>
Expand Down Expand Up @@ -1267,36 +1179,6 @@
<key>description</key>
<string>PNG Reference library</string>
</map>
<key>libuuid</key>
<map>
<key>platforms</key>
<map>
<key>linux64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>fb89f1281dd54d8b99b339fc5b712b27</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-libuuid/rev/314269/arch/Linux/installer/libuuid-1.6.2-linux64-314269.tar.bz2</string>
</map>
<key>name</key>
<string>linux64</string>
</map>
</map>
<key>license</key>
<string>UUID</string>
<key>license_file</key>
<string>LICENSES/uuid.txt</string>
<key>copyright</key>
<string>Copyright (c) 2004-2008 The OSSP Project &lt;http://www.ossp.org/&gt;</string>
<key>version</key>
<string>1.6.2</string>
<key>name</key>
<string>libuuid</string>
<key>description</key>
<string>OSSP uuid is a ISO-C:1999 application programming interface (API) and corresponding command line interface (CLI) for the generation of DCE 1.1, ISO/IEC 11578:1996 and RFC 4122 compliant Universally Unique Identifier (UUID). </string>
</map>
<key>libxml2</key>
<map>
<key>platforms</key>
Expand Down
95 changes: 56 additions & 39 deletions indra/cmake/00-Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
include_guard()

include(Variables)
include(Linker)

# We go to some trouble to set LL_BUILD to the set of relevant compiler flags.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{LL_BUILD}")
Expand Down Expand Up @@ -70,9 +69,12 @@ if (WINDOWS)
# http://www.cmake.org/pipermail/cmake/2009-September/032143.html
string(REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

add_link_options(/LARGEADDRESSAWARE
/NODEFAULTLIB:LIBCMT
/IGNORE:4099)
add_link_options(
/LARGEADDRESSAWARE
/NODEFAULTLIB:LIBCMT
/IGNORE:4099
/MANIFEST:NO
)

add_compile_definitions(
WIN32_LEAN_AND_MEAN
Expand All @@ -95,10 +97,10 @@ if (WINDOWS)
/permissive-
)

# Nicky: x64 implies SSE2
if( ADDRESS_SIZE EQUAL 32 )
add_compile_options( /arch:SSE2 )
endif()
# We want aggressive inlining on MSVC to better match clang/gcc at O3
string(REPLACE "/Ob2" "/Ob3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/Ob2" "/Ob3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/Ob2" "/Ob3" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")

# Are we using the crummy Visual Studio KDU build workaround?
if (NOT VS_DISABLE_FATAL_WARNINGS)
Expand All @@ -120,7 +122,6 @@ endif (WINDOWS)
if (LINUX)
set( CMAKE_BUILD_WITH_INSTALL_RPATH TRUE )
set( CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN/../lib )
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--exclude-libs,ALL")

find_program(CCACHE_EXE ccache)
if(CCACHE_EXE AND NOT DISABLE_CCACHE)
Expand All @@ -139,76 +140,92 @@ if (LINUX)
LL_IGNORE_SIGCHLD
)

if( ENABLE_ASAN )
add_compile_options(-U_FORTIFY_SOURCE
-fsanitize=address
--param asan-stack=0
)
add_link_options(-fsanitize=address)
else()
add_compile_definitions( _FORTIFY_SOURCE=2 )
endif()
if (USE_ASAN)
add_compile_options(-fsanitize=address -fsanitize-recover=address)
add_link_options(-fsanitize=address -fsanitize-recover=address)
elseif (USE_LEAKSAN)
add_compile_options(-fsanitize=leak)
add_link_options(-fsanitize=leak)
elseif (USE_UBSAN)
add_compile_options(-fsanitize=undefined -fno-sanitize=vptr)
add_link_options(-fsanitize=undefined -fno-sanitize=vptr)
elseif (USE_THREAD_SAN)
add_compile_options(-fsanitize=thread)
add_link_options(-fsanitize=thread)
else ()
add_compile_definitions(_FORTIFY_SOURCE=2)
endif ()

add_compile_options(
-fexceptions
-fno-math-errno
-fno-strict-aliasing
-fno-omit-frame-pointer
-fsigned-char
-msse2
-mfpmath=sse
-pthread
-fvisibility=hidden
-fstack-protector
)

add_link_options(
-Wl,--no-keep-memory
-Wl,--build-id
-Wl,--no-undefined
"LINKER:--build-id"
"LINKER:--as-needed"
"LINKER:-z,relro"
"LINKER:-z,now"
)

# this stops us requiring a really recent glibc at runtime
add_compile_options(-fno-stack-protector)
if(LINK_WITH_MOLD)
find_program(MOLD_BIN mold)
if(MOLD_BIN)
message(STATUS "Mold linker found: ${MOLD_BIN}. Enabling mold as active linker.")
add_link_options(-fuse-ld=mold)
else()
set(LINK_WITH_MOLD OFF)
message(STATUS "Mold linker not found. Using default linker.")
endif()
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# ND: clang is a bit more picky than GCC, the latter seems to auto include -lstdc++ and -lm. The former not so and thus fails to link
add_link_options(
-lstdc++
-lm
)
if(NOT LINK_WITH_MOLD)
# Use LLD for proper clang support under Linux
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_link_options(-fuse-ld=lld) # Use LLD for proper clang support
endif()
endif()

endif (LINUX)

if (DARWIN)
# Warnings should be fatal -- thanks, Nicky Perian, for spotting reversed default
set(CLANG_DISABLE_FATAL_WARNINGS OFF)
set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
set(DARWIN_extra_cstar_flags "-Wno-deprecated-declarations")
# Ensure that CMAKE_CXX_FLAGS has the correct -g debug information format --
# see Variables.cmake.
string(REPLACE "-gdwarf-2" "-g${CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT}"
CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DARWIN_extra_cstar_flags}")
# NOTE: it's critical that the optimization flag is put in front.
# NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered.
## Really?? On developer machines too?
##set(ENABLE_SIGNING TRUE)
##set(SIGNING_IDENTITY "Developer ID Application: Linden Research, Inc.")

# required for clang-15/xcode-15 since our boost package still uses deprecated std::unary_function/binary_function
# see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#C++-Standard-Library
add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
endif(DARWIN)

if(LINUX OR DARWIN)
add_compile_options(-Wall -Wno-sign-compare -Wno-trigraphs -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-local-typedef)
add_compile_options(-Wall -Wno-sign-compare -Wno-trigraphs -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable)

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# libstdc++ headers contain deprecated declarations that fail on clang
# macOS currently has many deprecated calls
add_compile_options(-Wno-unused-local-typedef -Wno-deprecated-declarations)
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-stringop-truncation -Wno-parentheses -Wno-c++20-compat)
add_compile_options(-Wno-stringop-truncation -Wno-parentheses)
endif()

if (NOT GCC_DISABLE_FATAL_WARNINGS)
if (NOT GCC_DISABLE_FATAL_WARNINGS AND NOT CLANG_DISABLE_FATAL_WARNINGS)
add_compile_options(-Werror)
endif ()

Expand Down
Loading
Loading