The primordial-element abundances from Big Bang nucleosynthesis, together with the cosmic microwave background, constrain the total baryonic density. massive compact halo objects such as ordinary faint stars, brown dwarfs and stellar remnants are baryonic whether or not they shine. With the stipulated density fractions, the entire baryonic budget is only one fifth of the required dark-matter density, and much of it is already accounted for by ordinary gas and stars.
A second test does not require a compact object to emit light: gravitational microlensing temporarily magnifies a background star as the object crosses the line of sight. Monitoring many Magellanic-Cloud stars constrains the microlensing optical depth and event-duration distribution. Surveys such as EROS-2 found too few suitable events for a standard halo predominantly composed of compact objects over their tested mass range.[ref]
Limits on the Macho Content of the Galactic Halo from the EROS-2 Survey of the Magellanic Clouds by the EROS-2 Collaboration. Abstract and halo-fraction limits; mass-dependent detection efficiency
Artificial-event injection, cadence and blending corrections are needed because very short or long events are easily missed; lensing by stars within the Clouds must also be separated from halo lensing. These are mass-range and halo-model constraints, not a proof excluding every compact-object mass. Primordial black holes are not limited by the ordinary-baryon budget in the same way as stellar remnants; their viability requires their own observational bounds.