add support for weak exports

(and generally flags, although no other flags are used yet)