VirtualBox

Changeset 43290 in vbox


Ignore:
Timestamp:
Sep 11, 2012 11:23:36 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
80702
Message:

Runtime: Speed up the mangling.h checks with some sed magic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile.kmk

    r43221 r43290  
    23042304 if1of ($(KBUILD_TARGET), win os2)
    23052305        $(call MSG_L1,IPRT: skipped mangling test.)
    2306  else if $(intersects $(KBUILD_TARGET), linux) && "$(VBOX_GCC_fvisibility-hidden)"
     2306 else
     2307# Generate a SED script from mangling.h that checks for known symbols.
     2308        @$(SED) \
     2309                -e '/# *define.*RT_MANGLER/!d' \
     2310                -e 's/^.*RT_MANGLER(\([^)][^)]*\)).*$(DOLLAR)/\/^\1$(DOLLAR)\/b ok/' \
     2311                $(PATH_ROOT)/include/iprt/mangling.h \
     2312                --output "$@"
     2313        @$(APPEND) -n '$@' \
     2314                ':bad' \
     2315                's/^\(.*\)$(DOLLAR)/error: Missing # define \1   RT_MANGLER(\1)/' \
     2316                'p' \
     2317                'q 1' \
     2318                '' \
     2319                ':ok' \
     2320                'd'
     2321# Find the best way to generate a symbol list and subject it to mangling.h.
     2322  if 1 && $(intersects $(KBUILD_TARGET), linux) && "$(VBOX_GCC_fvisibility-hidden)"
    23072323        $(call MSG_L1,IPRT: Testing mangling and visiblity...)
    2308         rcExit=0; \
    2309         for fn in ` readelf -Ws $^ \
    2310                         | $(SED) \
    2311                                 -e '/^  *[[:digit:]]\+:/!d' \
    2312                                 -e 's/^ \+[[:digit:]]\+: \+[[:xdigit:]]\+ \+[[:digit:]]\+ \+//' \
    2313                                 -e '/^SECTION/d' \
    2314                                 -e '/^FILE/d' \
    2315                                 -e 's/^[[:alpha:]]\+ \+//' \
    2316                                 -e '/LOCAL/d' \
    2317                                 -e 's/^[[:alpha:]]\+ \+//' \
    2318                                 -e '/^HIDDEN/d' \
    2319                                 -e 's/^[[:alpha:]]\+ \+//' \
    2320                                 -e '/^UND/d' \
    2321                                 -e 's/^[[:digit:]]\+ \+//' \
    2322                                 \
    2323                                 -e '/^nocrt_/d' \
    2324                                 -e '/^memchr/d' \
    2325                                 -e '/^memcmp/d' \
    2326                                 -e '/^memcpy/d' \
    2327                                 -e '/^mempcpy/d' \
    2328                                 -e '/^memmove/d' \
    2329                                 -e '/^memset/d' \
    2330                                 -e '/^strchr/d' \
    2331                                 -e '/^strpbrk/d' \
    2332                                 -e '/^_Z7strpbrk/d' \
    2333                                 -e '/^strcmp/d' \
    2334                                 -e '/^strcpy/d' \
    2335                                 -e '/^strncpy/d' \
    2336                                 -e '/^strlen/d' \
    2337                                 -e '/^_Z[[:alpha:]]*[[:digit:]]\+RTC/d' \
    2338                                 \
    2339                                 -e '/^_ZNSt9bad_allocC1Ev/d' \
    2340                                 -e '/^_ZNSt9exceptionC2Ev/d' \
    2341                                 \
    2342                                 -e '/^_Z[[:digit:]]\+dbus/d' \
    2343                                 -e '/^_Z13RTDBusLoadLibv/d' \
    2344                                 \
    2345                                 -e '/^VBoxHost_/d'\
    2346                                 -e '/^VBoxGuest_/d'\
    2347                         | sort -u \
    2348                   `; \
    2349         do \
    2350                 if $(SED) -ne '/\# *define '"$${fn}"' /q 1' $(PATH_ROOT)/include/iprt/mangling.h; then \
    2351                         echo "mangling.h: Missing # define "$${fn}"               RT_MANGLER("$${fn}")"; \
    2352                         rcExit=1;\
    2353                 fi \
    2354         done; \
    2355         exit $${rcExit}
    2356  else
     2324        @readelf -Ws $^ \
     2325                | $(SED) \
     2326                        -e '/^  *[[:digit:]]\+:/!d' \
     2327                        -e 's/^ \+[[:digit:]]\+: \+[[:xdigit:]]\+ \+[[:digit:]]\+ \+//' \
     2328                        -e '/^SECTION/d' \
     2329                        -e '/^FILE/d' \
     2330                        -e 's/^[[:alpha:]]\+ \+//' \
     2331                        -e '/LOCAL/d' \
     2332                        -e 's/^[[:alpha:]]\+ \+//' \
     2333                        -e '/^HIDDEN/d' \
     2334                        -e 's/^[[:alpha:]]\+ \+//' \
     2335                        -e '/^UND/d' \
     2336                        -e 's/^[[:digit:]]\+ \+//' \
     2337                        \
     2338                        -e '/^nocrt_/d' \
     2339                        -e '/^memchr/d' \
     2340                        -e '/^memcmp/d' \
     2341                        -e '/^memcpy/d' \
     2342                        -e '/^mempcpy/d' \
     2343                        -e '/^memmove/d' \
     2344                        -e '/^memset/d' \
     2345                        -e '/^strchr/d' \
     2346                        -e '/^strpbrk/d' \
     2347                        -e '/^_Z7strpbrk/d' \
     2348                        -e '/^strcmp/d' \
     2349                        -e '/^strcpy/d' \
     2350                        -e '/^strncpy/d' \
     2351                        -e '/^strlen/d' \
     2352                        -e '/^_Z[[:alpha:]]*[[:digit:]]\+RTC/d' \
     2353                        \
     2354                        -e '/^_ZNSt9bad_allocC1Ev/d' \
     2355                        -e '/^_ZNSt9exceptionC2Ev/d' \
     2356                        \
     2357                        -e '/^_Z[[:digit:]]\+dbus/d' \
     2358                        -e '/^_Z13RTDBusLoadLibv/d' \
     2359                        \
     2360                        -e '/^VBoxHost_/d'\
     2361                        -e '/^VBoxGuest_/d'\
     2362                | $(SED) -nf "$@"
     2363  else
    23572364        $(call MSG_L1,IPRT: Testing mangling...)
    2358         rcExit=0; \
    2359         for fn in ` nm $^ \
    2360                         | $(SED) -n \
    2361                                 -e 's/^[0-9a-f][0-9a-f]* //' \
    2362                                 -e '/^[TUDB] /!d' \
    2363                                 -e 's/^. //' \
    2364                                 \
    2365                                 -e '/^g_cchrt/d'\
    2366                                 -e '/^g_frt/d'\
    2367                                 -e '/^g_offrt/d'\
    2368                                 -e '/^g_pfnrt/d'\
    2369                                 -e '/^g_rt/d'\
    2370                                 -e '/^g_szrt/d'\
    2371                                 -e '/^g_ProcessSelf/d'\
    2372                                 -e '/^g_u64ProgramStart/d'\
    2373                                 -e '/^g_enmProcessPriority/d'\
    2374                                 -e '/^g_hDbgModStrCache/d'\
    2375                                 \
    2376                                 -e '/^RTDBusLoadLib/d' \
    2377                                 \
    2378                                 -e '/^RT/p' \
    2379                                 -e '/^g_/p' \
    2380                         | sort -u \
    2381                   `; \
    2382         do \
    2383                 if $(SED) -ne '/\# *define '"$${fn}"' /q 1' $(PATH_ROOT)/include/iprt/mangling.h; then \
    2384                         echo "mangling.h: Missing # define "$${fn}"               RT_MANGLER("$${fn}")"; \
    2385                         rcExit=1;\
    2386                 fi \
    2387         done; \
    2388         exit $${rcExit}
     2365        nm $^   | $(SED) -n \
     2366                        -e 's/^[0-9a-f][0-9a-f]* //' \
     2367                        -e '/^[TUDB] /!d' \
     2368                        -e 's/^. //' \
     2369                        \
     2370                        -e '/^g_cchrt/d'\
     2371                        -e '/^g_frt/d'\
     2372                        -e '/^g_offrt/d'\
     2373                        -e '/^g_pfnrt/d'\
     2374                        -e '/^g_rt/d'\
     2375                        -e '/^g_szrt/d'\
     2376                        -e '/^g_ProcessSelf/d'\
     2377                        -e '/^g_u64ProgramStart/d'\
     2378                        -e '/^g_enmProcessPriority/d'\
     2379                        -e '/^g_hDbgModStrCache/d'\
     2380                        \
     2381                        -e '/^RTDBusLoadLib/d' \
     2382                        \
     2383                        -e '/^RT/p' \
     2384                        -e '/^g_/p' \
     2385                | $(SED) -nf "$@"
     2386  endif
    23892387 endif
    23902388endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette