I was able to synthesize this answer for referencing lines of listings with this answer making colored, circled numbers. I did have to use TikZ.
Label a line with (*\codelabel{name}*) and reference it with \coderef{name}.
\documentclass{article}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{tikz}
\lstset{
basicstyle=\ttfamily,
escapeinside={(*}{*)}, % used to set up \codelabel
frame=tb
}
\newcommand*{\circled}[1]{\tikz[baseline=(char.base)]{%
\node[shape=circle,fill=black,draw,inner sep=0.5pt]
(char) {\footnotesize\textcolor{white}{#1}};}}
\newcounter{codectr}
\newcommand*{\codelabel}[1]{\refstepcounter{codectr}\circled{\arabic{codectr}}
\label{#1}}
\newcommand*{\coderef}[1]{\circled{\ref{#1}}}
\begin{document}
\begin{lstlisting}[caption={\itshape\texttt{type} and \texttt{attribute}
statements}]
attribute file_type; (*\codelabel{ft_attr}*)
attribute domain; (*\codelabel{dom_attr}*)
type system_data_file, file_type, data_file_type; (*\codelabel{sfd_type}*)
type untrusted_app, domain; (*\codelabel{untrusted}*)
\end{lstlisting}
Here, the first~\coderef{ft_attr} and second~\coderef{dom_attr} statements
declare the \verb+file_type+ and \verb+domain+ attributes, and the next
statement~\coderef{sfd_type} declares the \verb+system_data_file+
\end{document}

If you wish to use the hyperref package to make your references into clickable links, this works with that as well.