[BACK]Return to sunldgen.sh CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / rump

File: [cvs.NetBSD.org] / src / sys / rump / sunldgen.sh (download)

Revision 1.1, Fri Mar 15 12:12:16 2013 UTC (4 years, 5 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, rmind-smpnet-nbase, rmind-smpnet-base, rmind-smpnet, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226, nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406, nick-nhusb-base, nick-nhusb, netbsd-8-base, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, localcount-20160914, khorben-n900, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, agc-symver-base, agc-symver, HEAD
Branch point for: yamt-pagecache, tls-maxphys

Support generating support for Sun ld.

#       $NetBSD: sunldgen.sh,v 1.1 2013/03/15 12:12:16 pooka Exp $

# To support the Sun linker we need to make it behave like the GNU linker
# for orphaned sections.  That means generating __start/__stop symbols
# for them and that means some nopoly-atheist-withoutfood level trickery.
# We enumerate all the section names we wish to generate symbols for.
# The good news is that it's unlikely for NetBSD to grow any more
# link sets, and even if it does, it'll be a build-time failure
# on Sun platforms so it's easy to catch and mend the list below.

LINKSETS='rump_components evcnts prop_linkpools modules sysctl_funcs
	  bufq_strats domains dkwedge_methods ieee80211_funcs'
exec 1> ldscript_sun.rump
printf '# $NetBSD: sunldgen.sh,v 1.1 2013/03/15 12:12:16 pooka Exp $\n\n$mapfile_version 2\nLOAD_SEGMENT rumpkern_linksets {'
for lset in ${LINKSETS}; do
	printf '\n\tASSIGN_SECTION { IS_NAME= link_set_start_%s };\n' $lset
	printf '\tASSIGN_SECTION { IS_NAME= link_set_%s };\n' $lset
	printf '\tASSIGN_SECTION { IS_NAME= link_set_stop_%s };\n' $lset
	printf '\tOS_ORDER+= link_set_start_%s\n' $lset
	printf '\t    link_set_%s\n' $lset
	printf '\t    link_set_stop_%s;\n' $lset
echo '};'

exec 1> linksyms_sun.c
printf '/* $NetBSD: sunldgen.sh,v 1.1 2013/03/15 12:12:16 pooka Exp $ */\n\n'
for lset in ${LINKSETS}; do
	printf 'int __start_link_set_%s[0]\n' $lset
	printf '\t__attribute__((__section__("link_set_start_%s")));\n' $lset
	printf 'int __link_set_dummy_%s[0]\n' $lset
	printf '\t__attribute__((__section__("link_set_%s")));\n' $lset
	printf 'int __stop_link_set_%s[0]\n' $lset
	printf '\t__attribute__((__section__("link_set_stop_%s")));\n\n' $lset