mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-23 17:29:23 +08:00
labels: auto-promote EXTERN labels to GLOBAL if defined
If we define a label which was previously declared EXTERN, then automatically treat is as GLOBAL. Previously, we would fail to converge and loop forever, which is obviously not what we want. This is more user-friendly anyway. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
parent
4fb2acc0d3
commit
c5e45f6b70
@ -434,8 +434,14 @@ void define_label(const char *label, int32_t segment,
|
||||
*/
|
||||
lptr = find_label(label, true, &created);
|
||||
|
||||
if (!segment)
|
||||
if (segment) {
|
||||
/* We are actually defining this label */
|
||||
if (lptr->defn.type == LBL_EXTERN) /* auto-promote EXTERN to GLOBAL */
|
||||
lptr->defn.type = LBL_GLOBAL;
|
||||
} else {
|
||||
/* It's a pseudo-segment (extern, common) */
|
||||
segment = lptr->defn.segment ? lptr->defn.segment : seg_alloc();
|
||||
}
|
||||
|
||||
if (lptr->defn.defined || lptr->defn.type == LBL_BACKEND) {
|
||||
/* We have seen this on at least one previous pass */
|
||||
|
Loading…
Reference in New Issue
Block a user